WriteOff.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. * @author: xaboy<365615158@qq.com>
  4. * @day: 2017/11/11
  5. */
  6. namespace app\admin\model\ump;
  7. use crmeb\services\FormBuilder as Form;
  8. use crmeb\traits\ModelTrait;
  9. use crmeb\basic\BaseModel;
  10. use think\facade\Route as Url;
  11. use app\admin\model\store\StoreCategory as CategoryModel;
  12. /**
  13. * Class StoreCategory
  14. * @package app\admin\model\store
  15. */
  16. class WriteOff extends BaseModel
  17. {
  18. /**
  19. * 数据表主键
  20. * @var string
  21. */
  22. protected $pk = 'id';
  23. /**
  24. * 模型名称
  25. * @var string
  26. */
  27. protected $name = 'write_off';
  28. use ModelTrait;
  29. /**
  30. * @param $where
  31. * @return array
  32. */
  33. public static function systemPage($where)
  34. {
  35. $model = new self;
  36. $model = $model->alias('a')
  37. ->field('a.*,b.nickname,c.coupon_title,c.coupon_price,d.name as d_name')
  38. ->order('a.id DESC ')
  39. ->leftJoin('user b', 'b.uid = a.uid')
  40. ->leftJoin('store_coupon_user c', 'c.id = a.coupon_id')
  41. ->leftJoin('system_store d', 'd.id = c.store_id');
  42. if ($where['title'] != '') $model = $model->where('b.uid|b.nickname', 'LIKE', "%$where[title]%");
  43. // if($where['is_del'] != '') $model = $model->where('is_del',$where['is_del']);
  44. $list = self::page($model, $where);
  45. if ($list){
  46. foreach ($list['list'] as &$v){
  47. $v['add_time'] = $v['add_time'] > 0 ? date('Y-m-d H:i:s', $v['add_time']) : 0;
  48. }
  49. }
  50. return $list;
  51. }
  52. }