123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- namespace app\dao\order;
- use app\dao\BaseDao;
- use app\model\order\StoreOrderCartInfo;
- class StoreOrderCartInfoDao extends BaseDao
- {
-
- protected function setModel(): string
- {
- return StoreOrderCartInfo::class;
- }
-
- public function getCartInfoList(array $where, array $field = ['*'])
- {
- return $this->search($where)->field($field)->select()->toArray();
- }
-
- public function getCartColunm(array $where, string $field, string $key = '')
- {
- return $this->search($where)->order('id asc')->column($field, $key);
- }
-
- public function getSplitCartNum($cart_ids)
- {
- $res = $this->getModel()->whereIn('old_cart_id', $cart_ids)->field('sum(cart_num) as num,old_cart_id')->group('old_cart_id')->select()->toArray();
- $data = [];
- foreach ($res as $value) {
- $data[$value['old_cart_id']] = $value['num'];
- }
- return $data;
- }
-
- public function getAdventCartInfoList(int $time = 0, int $writeTime = 0)
- {
- $list = $this->getModel()->where(['is_writeoff' => 0, 'is_advent_sms' => 0])->where('write_start', '>', 0)->where('write_end', '>', 0)
- ->where('write_end', '>', $time)->where('write_end', '<=', $writeTime)
- ->field('id,oid,product_id,write_times,write_surplus_times,write_start,write_end,cart_info')->select();
- $list = count($list) > 0 ? $list->toArray() : [];
- return $list;
- }
-
- public function getExpireCartInfoList(int $writeTime = 0)
- {
- $list = $this->getModel()->where(['is_writeoff' => 0, 'is_expire_sms' => 0])->where('write_start', '>', 0)->where('write_end', '>', 0)
- ->where('write_end', '<', $writeTime)
- ->field('id,oid,product_id,write_times,write_surplus_times,write_start,write_end,cart_info')->select();
- $list = count($list) > 0 ? $list->toArray() : [];
- return $list;
- }
- }
|