merId = $this->request->route('merId'); } /** * 生成二维码 */ public function qrcode() { $common = app()->make(Common::class); $siteUrl = systemConfig('site_url'); $data = $common->Qrcode(['code' => $siteUrl . 'download/index.html?code=mer_' . $this->merId, 'id' => $this->merId]); return app('json')->success(['url' => $data]); } /** * 邀请记录 * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function record() { [$page, $limit] = $this->getPage(); $query = FinancialRecord::field('order_sn,number') ->where('mer_id', $this->merId) ->where('financial_type', 'commission_to_promoter') ->with(['orderInfo' => function (Query $query) { $query->field('pay_price,real_name,uid,order_sn')->with(['user' => function (Query $query) { $query->field('nickname,uid'); }]); }]); $count = $query->count(); $result = $query->page($page, $limit)->select()->toArray(); $list = []; foreach ($result as $item) { $list[] = [ 'nickname' => $item['orderInfo']['user']['nickname'], 'uid' => $item['orderInfo']['uid'], 'order_amount' => $item['orderInfo']['pay_price'], 'commission' => $item['number'], ]; } return app('json')->success(['count' => $count, 'list' => $list]); } public function subsidy() { $type = $this->request->get('type', 1); $saleAmount = Merchant::where('mer_id', $this->merId)->value('sale_amount'); if ($type == 1) { $purchaseAmount = StoreConsumptionUser::where('uid') ->where('') ->column('coupon_price,balance'); } } }