新增代购订单接口
This commit is contained in:
parent
d5ccd8a04b
commit
a08e722b34
@ -1585,6 +1585,47 @@ class StoreOrderRepository extends BaseRepository
|
||||
return compact( 'count','list');
|
||||
}
|
||||
|
||||
/**代购订单使用
|
||||
* @param array $where
|
||||
* @param $page
|
||||
* @param $limit
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
* @author xaboy
|
||||
* @day 2020/6/10
|
||||
*/
|
||||
public function getList2(array $where, $page, $limit,$cart_id_str)
|
||||
{
|
||||
$query = $this->dao->search($where)->where('StoreOrder.is_del', 0)->where( 'cart_id','exp', 'REGEXP \''."(^|,)(".$cart_id_str.")(,|$)".'\'');
|
||||
$count = $query->count();
|
||||
$list = $query->with([
|
||||
'orderProduct',
|
||||
'presellOrder',
|
||||
'merchant' => function ($query) {
|
||||
return $query->field('mer_id,mer_name');
|
||||
},
|
||||
'community',
|
||||
'receipt' => function ($query) {
|
||||
return $query->field('order_id,order_receipt_id');
|
||||
},
|
||||
])->page($page, $limit)->order('pay_time DESC')->append(['refund_status'])->select();
|
||||
|
||||
foreach ($list as $order) {
|
||||
if ($order->activity_type == 2) {
|
||||
if ($order->presellOrder) {
|
||||
$order->presellOrder->append(['activeStatus']);
|
||||
$order->presell_price = bcadd($order->pay_price, $order->presellOrder->pay_price, 2);
|
||||
} else {
|
||||
$order->presell_price = $order->pay_price;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return compact( 'count','list');
|
||||
}
|
||||
|
||||
public function userList($uid, $page, $limit)
|
||||
{
|
||||
$query = $this->dao->search([
|
||||
|
@ -19,6 +19,7 @@ use think\App;
|
||||
use think\facade\Db;
|
||||
use app\common\model\user\User;
|
||||
use app\validate\api\EnterCompanyValidate;
|
||||
use app\common\repositories\store\order\StoreOrderRepository;
|
||||
|
||||
use function GuzzleHttp\json_decode;
|
||||
|
||||
@ -73,5 +74,22 @@ class EnterCompany extends BaseController
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
// 获取代购订单
|
||||
public function get_list($page=1,$limit=10)
|
||||
{
|
||||
$uid = $this->request->uid();
|
||||
$where = ['uid' => $this->request->uid()];
|
||||
$cart_id = Db::table('eb_store_cart')
|
||||
->where('uid', '=', $uid)
|
||||
->where('is_dg', '=', 1)
|
||||
->where('is_pay', '=', 1)
|
||||
->where('is_fail', '=', 0)
|
||||
->where('is_del', '=', 0)
|
||||
->column('cart_id');
|
||||
$cart_id_str = implode('|',$cart_id);
|
||||
$list = app()->make(StoreOrderRepository::class)->getList2($where,$page,$limit,$cart_id_str);
|
||||
return app('json')->success($list);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -356,6 +356,8 @@ Route::group('api/', function () {
|
||||
Route::post('entercompany', 'api.enter.EnterCompany/add');
|
||||
// 获取已录入公司
|
||||
Route::get('enter/list', 'api.enter.EnterCompany/list');
|
||||
// 获取代购订单
|
||||
Route::get('enter/get_list', 'api.enter.EnterCompany/get_list');
|
||||
})->middleware(UserTokenMiddleware::class, true);
|
||||
|
||||
//非强制登录
|
||||
|
Loading…
x
Reference in New Issue
Block a user