12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- namespace app\models\merchant;
- use crmeb\basic\BaseModel;
- use crmeb\traits\ModelTrait;
- class MerchantCodeAudit extends BaseModel
- {
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'id';
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'merchant_code_audit';
- use ModelTrait;
- public static function getList($where = null)
- {
- $data = ($data = self::setWhere($where)->page($where['page'] ?? 1, $where['limit'] ?? 10)->select()) && count($data) ? $data->toArray() : [];
- foreach ($data as &$item) {
- $item['mer_name'] = (Merchant::where('id', $item['mer_id'])->find())['name'] ?: '';
- switch ($item['status']) {
- case 0:
- $item['state'] = '审核成功';
- break;
- case 1:
- $item['state'] = '审核被拒绝';
- break;
- case 2:
- $item['state'] = '审核中';
- break;
- case 3:
- $item['state'] = '已撤回';
- break;
- case 4:
- $item['state'] = '审核延后';
- break;
- }
- }
- $count = self::setWhere($where)->count();
- return ['count' => $count, 'list' => $data];
- }
- public static function setWhere($where)
- {
- $model = (new self);
- if ($where['mer_id']) {
- $model = $model->where('mer_id', $where['mer_id']);
- }
- if ($where['auditid']) {
- $model = $model->where('auditid', $where['auditid']);
- }
- if ($where['status']) {
- $model = $model->where('status', $where['status']);
- }
- return $model;
- }
- }
|