Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
2cc737cd20
@ -940,7 +940,7 @@ class Auth extends BaseController
|
||||
if ($code && ($info = app()->make(RoutineQrcodeRepository::class)->getRoutineQrcodeFindType($code))) {
|
||||
$auth['auth']['spread'] = $info['third_id'];
|
||||
}
|
||||
if (!$user) {
|
||||
if (!$user || empty($user['account'])) {
|
||||
$uni = uniqid(true, false) . random_int(1, 100000000);
|
||||
$key = 'U' . md5(time() . $uni);
|
||||
Cache::set('u_try' . $key, ['id' => $authInfo['wechat_user_id'], 'type' => $authInfo['user_type'], 'spread' => $auth['auth']['spread'] ?? 0], 3600);
|
||||
|
@ -563,26 +563,16 @@ class User extends BaseController
|
||||
public function merchantRecord()
|
||||
{
|
||||
[$page, $limit] = $this->getPage();
|
||||
$userIds = UserModel::where('spread_uid', $this->user->uid)->column('uid');
|
||||
$userIds = UserModel::where('spread_uid', $this->user->uid)->page($page, $limit)->column('uid');
|
||||
$query = Merchant::whereIn('uid', $userIds)->where('is_del', 0);
|
||||
$merchants = $query->page($page, $limit)
|
||||
->field('mer_id,mer_name,uid,real_name')
|
||||
->field('mer_id,mer_name,uid,real_name,sale_amount,purchase_amount as buy_amount')
|
||||
->select()->toArray();
|
||||
$dao = new StoreOrderDao();
|
||||
/** @var PresellOrderRepository $preSellDao */
|
||||
$preSellRepo = app()->make(PresellOrderRepository::class);
|
||||
$merchants = reset_index($merchants, 'uid');
|
||||
$result = [];
|
||||
foreach ($userIds as $userId) {
|
||||
if (isset($merchants[$userId])) {
|
||||
$merchant = $merchants[$userId];
|
||||
$saleOrderQuery = $dao->search(['mer_id' => $merchant['mer_id']])->whereIn('StoreOrder.status', [0, 1, 2, 3, 9, 10])->where('paid', 1);
|
||||
$saleOrderIds = $saleOrderQuery->column('order_id');
|
||||
$saleAmount1 = $saleOrderQuery->sum('StoreOrder.pay_price');
|
||||
$saleAmount2 = $preSellRepo->search(['paid' => 1, 'order_ids' => $saleOrderIds])->sum('pay_price');
|
||||
$merchant['sale_amount'] = bcadd($saleAmount1, $saleAmount2, 2);
|
||||
$merchant['buy_amount'] = StoreOrderOther::where('uid', $merchant['uid'])->whereIn('status', [0, 1, 2, 3, 9, 10])->where('paid', 1)->sum('pay_price');
|
||||
$merchant['buy_amount'] = bcadd($merchant['buy_amount'], 0, 2);
|
||||
$merchant['status'] = 1;
|
||||
$result[] = $merchant;
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user