StoreOrderEconomize.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\model\order;
  12. use app\model\user\User;
  13. use crmeb\basic\BaseModel;
  14. use crmeb\traits\ModelTrait;
  15. use think\Model;
  16. /**
  17. *
  18. * Class StoreOrder
  19. * @package app\model\order
  20. */
  21. class StoreOrderEconomize extends BaseModel
  22. {
  23. use ModelTrait;
  24. /**
  25. * 数据表主键
  26. * @var string
  27. */
  28. protected $pk = 'id';
  29. /**
  30. * 模型名称
  31. * @var string
  32. */
  33. protected $name = 'store_order_economize';
  34. protected $insert = ['add_time'];
  35. /**
  36. * 更新时间
  37. * @var bool | string | int
  38. */
  39. protected $updateTime = false;
  40. /**
  41. * 一对一关联用户表
  42. * @return \think\model\relation\HasOne
  43. */
  44. public function user()
  45. {
  46. return $this->hasOne(User::class, 'uid', 'uid')->field(['uid', 'nickname', 'phone', 'spread_uid'])->bind([
  47. 'nickname' => 'nickname',
  48. 'phone' => 'phone',
  49. ]);
  50. }
  51. /**
  52. * 订单搜索
  53. * @param Model $query
  54. * @param $value
  55. */
  56. public function searchOrderIdAttr($query, $value)
  57. {
  58. $query->where('order_id', $value);
  59. }
  60. }