1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace app\models\system;
- use crmeb\traits\ModelTrait;
- use crmeb\basic\BaseModel;
- /**
- * Class ShippingTemplates
- * @package app\models\system
- */
- class ShippingTemplates extends BaseModel
- {
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'shipping_templates';
- use ModelTrait;
- public static function merSet($mer_id)
- {
- return $mer_id ? self::where('mer_id', $mer_id) : new self;
- }
- public function getTypeAttr($value)
- {
- $status = [1 => '按件数', 2 => '按重量', 3 => '按体积'];
- return $status[$value];
- }
- public function getAppointAttr($value)
- {
- $status = [1 => '开启', 0 => '关闭'];
- return $status[$value];
- }
- public function getAddTimeAttr($value)
- {
- $value = date('Y-m-d H:i:s', $value);
- return $value;
- }
- /**
- * 运费模板列表
- * @param array $where
- * @return array
- */
- public static function getList($where = [])
- {
- $model = new self();
- if (isset($where['mer_id']) && $where['mer_id'] != '') $model = $model->where('mer_id', $where['mer_id']);
- if (isset($where['name']) && $where['name'] != '') $model = $model->where('name', 'like', "%$where[name]%");
- $data = $model->page($where['page'], $where['limit'])->order('sort', 'desc')->select()->toArray();
- $count = $model->count();
- return compact('count', 'data');
- }
- }
|