0){ $saas_user = get_saas_user(); if($saas_user->parent_id > 0) { $data = [ 'code' => 0, 'msg' => '用户已经有上级', ]; } else { if ($parent_id == $saas_user->id) { $data = [ 'code' => 0, 'msg' => '上级不能是自己', ]; } else { $saas = SaasUser::findOne(['id' => $saas_user->id, 'is_delete' => 0]); $saas->parent_id = $parent_id; if ($saas->save()) { $data = [ 'code' => 0, 'msg' => '绑定成功', ]; } else { $data = [ 'code' => 0, 'msg' => '绑定失败请稍后再试', ]; } } } } else { $data = [ 'code' => 0, 'msg' => '用户未找到', ]; } return $this->asJson($data); } /** * 获取提现方式 */ public function actionGetCashMethod() { $saas_user = get_saas_user(); $cash_method = []; if (!empty($saas_user->withdraw_method)) { $decode = json_decode($saas_user->withdraw_method, true); if (is_array($decode)) { $cash_method = $decode; } } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'list' => $cash_method, ], ]); } /** * 删除提现方式 */ public function actionDelCashMethod() { $saas_user = get_saas_user(); $type = post_params('type'); if (empty($type)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误', ]); } if (empty($saas_user->withdraw_method)) { return $this->asJson([ 'code' => 0, 'msg' => '操作成功', ]); } $cash_method = json_decode($saas_user->withdraw_method, true); if (is_array($cash_method)) { foreach ($cash_method as $key => $value) { if ($value['type'] == $type) { unset($cash_method[$key]); } } $saas_user->withdraw_method = json_encode(array_values($cash_method)); } else { $saas_user->withdraw_method = ''; } if ($saas_user->save()) { return $this->asJson([ 'code' => 0, 'msg' => '操作成功', ]); } return $this->asJson([ 'code' => 0, 'msg' => '操作失败', ]); } /** * 添加提现方式 */ public function actionAddCashMethod() { $type = post_params('type'); if (empty($type)) { return $this->asJson([ 'code' => 1, 'msg' => '参数错误', ]); } $name = post_params('name'); $account = post_params('account'); $bank = post_params('bank'); $branch = post_params('branch'); if (empty($name) || empty($account)) { return $this->asJson([ 'code' => 1, 'msg' => '账号和姓名不能为空', ]); } if ($type == 'bank_card' && (empty($bank) || empty($branch))) { return $this->asJson([ 'code' => 1, 'msg' => '银行或支行不能为空', ]); } $data = [ 'type' => $type, 'name' => $name, 'account' => $account, ]; if ($type == 'bank_card') { $data['bank'] = $bank; $data['branch'] = $branch; } $saas_user = get_saas_user(); if (empty($saas_user->withdraw_method)) { $saas_user->withdraw_method = json_encode(array_values([$data])); } else { $decode = json_decode($saas_user->withdraw_method, true); if (!$decode) { $saas_user->withdraw_method = json_encode(array_values([$data])); } else { foreach ($decode as $key => $value) { if ($value['type'] == $type) { unset($decode[$key]); break; } } $decode[] = $data; $saas_user->withdraw_method = json_encode(array_values($decode)); } } if ($saas_user->save()) { return $this->asJson([ 'code' => 0, 'msg' => '操作成功', ]); } return $this->asJson([ 'code' => 1, 'msg' => '操作失败', ]); } /** * @return mixed|string * 获取佣金相关 */ public function actionGetPrice() { $saas_id = get_saas_user_id(); $form = new ShareForm(); $form->store_id = get_store_id(); //$form->user_id = get_user_id(); $form->saas_id = $saas_id; $res['data']['price'] = $form->getPrice(); $setting = Option::get('share_basic_setting', get_store_id()); $setting = $setting ? Json::decode($setting['value']) : []; $res['data']['pay_type'] = $setting['pay_type']['value']; //暂时去掉 //$res['data']['bank'] = $setting['bank']['value']; //余额支付 商盟没有 //$res['data']['remaining_sum'] = $setting['remaining_sum']['value']; $cash_last = Cash::find()->where(['saas_id' => $saas_id, 'is_delete' => 0]) ->orderBy(['id' => SORT_DESC])->select(['name', 'mobile', 'type', 'bank_name'])->asArray()->one(); $res['data']['cash_last'] = $cash_last; $cash_max_day = floatval($setting['cash_max_day']['value']); if ($cash_max_day) { $cash_sum = Cash::find()->where([ 'store_id' => get_store_id(), 'is_delete' => 0, 'status' => [0, 1, 2, 5], ])->andWhere([ 'AND', ['>=', 'created_at', strtotime(date('Y-m-d 00:00:00'))], ['<=', 'created_at', strtotime(date('Y-m-d 23:59:59'))], ])->sum('price'); $cash_max_day = $cash_max_day - ($cash_sum ? $cash_sum : 0); $res['data']['cash_max_day'] = max(0, floatval(sprintf('%.2f', $cash_max_day))); } else { $res['data']['cash_max_day'] = -1; } $cashServiceCharge = floatval($setting['cash_service_charge']['value']); $res['data']['cash_service_charge'] = $cashServiceCharge; if($cashServiceCharge == 0){ $res['data']['service_content'] = ""; }else{ $res['data']['service_content'] = "提现需要加收{$cashServiceCharge}%手续费"; } $wxappUrl = \Yii::$app->request->hostInfo . \Yii::$app->request->baseUrl . '/statics/wxapp/images'; $payTypeList = [ [ 'icon' => $wxappUrl . '/icon-share-wechat.png', 'name' => '微信', 'is_show' => false ], [ 'icon' => $wxappUrl . '/icon-share-ant.png', 'name' => '支付宝', 'is_show' => false ], [ 'icon' => $wxappUrl . '/icon-share-bank.png', 'name' => '银行卡', 'is_show' => false ], // [ // 'icon' => $wxappUrl . '/gold.png', // 'name' => '余额', // 'is_show' => false // ], ]; if(isset($res['data']['pay_type'])){ foreach($res['data']['pay_type'] as $val){ if($val == 'alipay'){ $payTypeList[1]['is_show'] = true; } if($val == 'wechat'){ $payTypeList[0]['is_show'] = true; } if($val == 'bank'){ $payTypeList[2]['is_show'] = true; } } } // if($res['data']['remaining_sum'] && $res['data']['remaining_sum'] == 1){ // $payTypeList[3]['is_show'] = true; // } $res['data']['pay_type_list'] = $payTypeList; $res['data']["cash_success_tpl"] = ''; $res['data']["cash_fail_tpl"]= ''; //获取分销订单 //$res['data']['fx_list'] = Cash::find()->Where(['saas_id' => $saas_id, 'is_delete' => 0]) // ->orderBy('id desc')->asArray()->one(); //新提现方式 $res['data']['cash_method_list'] = []; $saas_user = get_saas_user(); if (!empty($saas_user->withdraw_method)) { $cash_method = json_decode($saas_user->withdraw_method, true); if (is_array($cash_method)) { $res['data']['cash_method_list'] = $cash_method; } } return $this->asJson(['code' => 0, 'msg' => 'success', 'data' => $res['data']]); } /** * @return mixed|string * 申请提现 */ public function actionApply() { $form = new CashForm(); $form->saas_id = get_saas_user_id(); $form->store_id = get_store_id(); $form->attributes = post_params(); return $this->asJson($form->save()); } /** * @return mixed|string * 申请提现 */ public function actionIndex() { $form = new ShareForm(); return $this->asJson($form->getShareSetting()); } /** * 提现明细列表 */ public function actionCashDetail() { $form = new CashListForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $form->user_id = get_user_id(); $form->saas_id = get_saas_user_id(); return $this->asJson($form->getList()); } /** * @return mixed|string * 获取团队详情 */ public function actionGetTeam() { $form = new TeamForm(); $form->attributes = get_params(); $form->user_id = get_user_id(); $form->store_id = get_store_id(); $form->saas_id = get_saas_user_id(); $form->scenario = "TEAM"; $form->level = get_params('level',1); return $this->asJson($form->getTeam()); } /** * @return mixed|string * 获取团队详情 */ public function actionGetTeamCount() { $form = new TeamForm(); $form->attributes = get_params(); $form->saas_id = get_saas_user_id(); $form->scenario = "TEAM"; $info = $form->getTeamCount(); $data = [ 'code' => 0, 'msg' => '', 'data' => $info ]; return $this->asJson($data); } /** * 推荐人列表 * @return Response * @throws InvalidConfigException * @throws Throwable * @throws Exception */ public function actionReferralList() { $status = get_params('status', 1); $saas_id = get_saas_user_id(); $query = SaasStoreReferral::find()->alias('ssr')->leftJoin(['su' => SaasUser::tableName()], 'ssr.referral_id = su.id'); $query->leftJoin(['s' => Store::tableName()], 'ssr.store_id = s.id'); $query->where(['ssr.is_enable' => $status,'su.id'=>$saas_id]); $query->select('ssr.id, ssr.store_id, ssr.referral_id, ssr.is_enable, s.name as store_name,s.created_at,s.user_name,s.contact_tel ,s.logo, ssr.referral_rebate, su.avatar, su.name as nickname, su.mobile, su.id as saas_id'); $list = pagination_make($query); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } /** * 店铺分销订单 */ public function actionDistributionOrder(){ $this->getOrderInfo(0); } /** * 推荐店铺订单 */ public function actionRecommendOrder(){ $this->getOrderInfo(2); } /** * 会员分销订单 */ public function actionMemberOrder(){ $this->getOrderInfo(1); } /** * 会员分销订单 */ public function actionSelfOrder(){ $this->getOrderInfo(5); } /** * 灵活分润 */ public function actionCustomSharingOrder(){ $this->getOrderInfo(6); } /** * 供货商分润订单(非分账) */ public function actionSupplierOrder() { $saas_id = get_saas_user_id(); $status = intval(get_params('status')); $query = SaasUserPriceLog::find()->alias('pl') ->leftJoin(['ot' => OrderTransit::tableName()], "pl.order_no LIKE 'PO%' AND pl.order_no = ot.cloud_order_no AND ot.is_delete = 0") ->leftJoin(['po' => PurchaseOrder::tableName()], "pl.order_no LIKE 'AP%' AND pl.order_no = po.order_no AND po.is_delete = 0") ->where([ 'pl.saas_id' => $saas_id, 'pl.log_type' => SaasUserPriceLog::LOG_TYPE_INCOME, 'pl.amount_type' => SaasUserPriceLog::AMOUNT_TYPE_SUPPLIER_PARENT ]); if ($status === 1) { $query->andWhere(['OR', [//查询未完成的订单 'ot.status' => [-1, 0, 1]//取消 / 转单创建成功 / 已发货 ], [ 'po.trade_status' => [-1, 0, 1, 2]//默认 / 待发货 / 已取消 / 已发货 ]]); } if ($status === 2) { $query->andWhere(['OR', [//查询未完成的订单 'ot.status' => 2//已确认收货 ], [ 'po.trade_status' => 3//已确认 ]]); } $query->orderBy('pl.created_at DESC')->select([ 'pl.id', 'pl.saas_id', 'pl.amount', 'pl.created_at', 'COALESCE(ot.cloud_order_no, po.order_no) AS order_no', 'COALESCE(ot.status, po.trade_status) AS trade_status', 'ot.goods_info' ]); $list = pagination_make($query); foreach ($list['list'] as &$item) { $orderNoHead = substr($item['order_no'], 0, 2); $item['saasInfo'] = [ 'name' => '', 'avatar' => '' ]; if ($orderNoHead === 'PO') { $order_detail = []; $goods_info = json_decode($item['goods_info'], true); foreach ($goods_info as $goods_index => $goods_item) { $order_detail[$goods_index]['num'] = $goods_item['num']; $order_detail[$goods_index]['attr'] = $goods_item['attr']; $order_detail[$goods_index]['total_price'] = $goods_item['price']; $order_detail[$goods_index]['pic'] = $goods_item['pic_url']; $order_detail[$goods_index]['goods_name'] = $goods_item['goods_name'] ?: ''; } if (intval($item['trade_status']) === -1) { $item['trade_status'] = 1; } if (intval($item['trade_status']) === 1) { $item['trade_status'] = 2; } if (intval($item['trade_status']) === 2) { $item['trade_status'] = 3; } $orderTransit = OrderTransit::findOne(['cloud_order_no' => $item['order_no'], 'is_delete' => 0]); $order = Order::findOne($orderTransit->order_id); if ($order->saas_id) { $saasInfo = SaasUser::findOne($order->saas_id); $item['saasInfo'] = [ 'name' => $saasInfo->name, 'avatar' => $saasInfo->avatar ]; } else { $userInfo = User::findOne($order->user_id); if ($userInfo->binding) { $saasInfo = SaasUser::findOne(['mobile' => $userInfo->binding, 'is_delete' => 0]); $item['saasInfo'] = [ 'name' => $saasInfo->name, 'avatar' => $saasInfo->avatar ]; } } } else { $purchaseOrder = PurchaseOrder::findOne(['order_no' => $item['order_no'], 'is_delete' => 0]); $order_detail = PurchaseOrderDetail::find()->where(['order_id' => $purchaseOrder->id, 'is_delete' => 0]) ->select('goods_name, num, pic, total_price, attr')->asArray()->all(); if(!empty($purchaseOrder->saas_id)){ $saasInfo = SaasUser::find()->where(['id' => $purchaseOrder['saas_id'], 'is_delete'=>0]) ->select('name, avatar')->asArray()->one(); $item['saasInfo'] = $saasInfo; } } foreach ($order_detail as &$order_detail_item) { $order_detail_item['attr'] = json_decode($order_detail_item['attr'], true); } $item['goods'] = $order_detail; $item['trade_status'] = intval($item['trade_status']); $item['status'] = 1; $item['created_at'] = date('Y-m-d H:i:s', $item['created_at']); } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } // private function getOrderInfo($from = 0){ $status = get_params('status',0); $page = get_params('page',1); //会员分销订单 $saas_id = get_saas_user_id(); $saasIds = SaasUser::find()->where(['parent_id'=>$saas_id])->asArray()->all(); $levelSaasIds = ''; if(!empty($saasIds) && count($saasIds) > 0) { foreach($saasIds as $val){ $levelSaasIds .= $val['id'].','; } } $levelSaasIds .= $saas_id; $sql_count = "select count(o.order_no) num from `cyy_sharing_receiver` as s inner join ( ( select id order_id,order_no,trade_status,is_pay,pay_type from cyy_order ) union (select id order_id,order_no,trade_status,is_pay,pay_type from cyy_scan_code_pay_order ) ) as o on s.`order_no`= o.`order_no` where s.saas_id={$saas_id} "; $sql = "select o.*,s.amount, s.is_pay as status from `cyy_sharing_receiver` as s inner join ( ( select id order_id,order_no,trade_status,is_pay,pay_type,saas_id,0 as order_type, created_at from cyy_order ) union (select id order_id,order_no,trade_status,is_pay,pay_type,saas_id,1 as order_type, created_at from cyy_scan_code_pay_order ) ) as o on s.`order_no`= o.`order_no` where s.saas_id={$saas_id} "; if(in_array($from, [ SharingReceiver::FROM_STORE, SharingReceiver::FROM_PLATFORM, SharingReceiver::FROM_RECOMMEND, SharingReceiver::FROM_SELF, SharingReceiver::FROM_CUSTOM ])){ $sql_count .= " and s.from = {$from}"; $sql .= " and s.from = {$from}"; } // if ($status == 1) {//待付款 // $is_pay = Order::IS_PAY_FALSE; // $sql_count .= " and o.is_pay = {$is_pay} and o.pay_type !=2 and o.trade_status !=1"; // $sql .= " and o.is_pay = {$is_pay} and o.pay_type !=2 and o.trade_status !=1"; // } if ($status == 1) {//已付款 $trade_status = Order::ORDER_FLOW_NO_SEND; $sql_count .= " and o.trade_status = {$trade_status} and o.is_pay = 1"; $sql .= " and o.trade_status = {$trade_status} and o.is_pay = 1"; } if ($status == 2) {//已完成 $trade_status = Order::ORDER_FLOW_CONFIRM; $sql_count .= " and o.trade_status = {$trade_status} and o.is_pay = 1"; $sql .= " and o.trade_status = {$trade_status} and o.is_pay = 1"; } $connection_count = \Yii::$app->db; $command_count = $connection_count->createCommand($sql_count); $info = $command_count->queryOne(); $start = ($page - 1) * $this->pageLimit; $sql .= " limit {$start} , {$this->pageLimit} "; $command = $connection_count->createCommand($sql); $list['list'] = $command->queryAll(); $list['pageNo'] = $page; $list['totalCount'] = $info['num']; if(count($list['list']) > 0 ){ foreach($list['list'] as $key=>$val){ if(isset($val['order_id']) && !empty($val['order_id']) ){ $orderNoHead = substr($val['order_no'], 0, 2); if($orderNoHead == 'SC'){ $list['list'][$key]['goods'] = [ [ "goods_id" => '10', "goods_name" => '扫码支付', "num" => '1', "pic" => '', "goods_info" => null, "total_price" => '', ] ]; }else{ $goodsInfo = OrderDetail::find()->where(['order_id' => $val['order_id'], 'is_delete' => 0])->select('goods_id, goods_name, num, pic, attr, total_price')->asArray()->all(); foreach ($goodsInfo as &$goods_item) { $goods_item['attr'] = json_decode($goods_item['attr'], true); } $list['list'][$key]['goods'] = $goodsInfo; } } if(isset($val['saas_id']) && $val['saas_id'] > 0){ $saasInfo = SaasUser::find()->where(['id'=>$val['saas_id'],'is_delete'=>0])->select('name,avatar')->asArray()->one(); $list['list'][$key]['saasInfo'] = $saasInfo; } $list['list'][$key]['status'] = intval($val['status']) ? 1 : 0; $list['list'][$key]['created_at'] = date('Y-m-d H:i:s', $val['created_at']); } } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } /** * 下级供货商 */ public function actionSubSupplier(){ $saas_id = get_saas_user_id(); $query = SaasSupplierReferral::find()->alias('ssr') ->leftJoin(['s' => Supplier::tableName()], 'ssr.supplier_id = s.id') ->where(['ssr.referral_id' => $saas_id, 's.is_delete' => 0]) ->andWhere(['IS NOT', 's.id', NULL]) ->select('ssr.supplier_id, ssr.referral_rebate, ssr.is_enable'); $list = pagination_make($query); foreach ($list['list'] as &$item) { $supplier = Supplier::findOne($item['supplier_id']); $item['supplier_name'] = $supplier->supplier_name; $item['logo'] = $supplier->logo; $item['is_enable'] = intval($item['is_enable']); $item['created_at'] = $item['created_at'] > 0 ? date('Y-m-d H:i:s', $item['created_at']) : ''; $item['amount'] = SaasUserPriceLog::find()->where([ 'log_type' => SaasUserPriceLog::LOG_TYPE_INCOME, 'amount_type' => SaasUserPriceLog::AMOUNT_TYPE_SUPPLIER_PARENT, 'supplier_id' => $item['supplier_id'] ])->sum('amount') ?: 0; } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } /** * 会员卡 */ public function actionBusinessOrder(){ $saas_id = get_saas_user_id(); // $saasIds = SaasUser::find()->where(['parent_id'=>$saas_id])->select('id')->asArray()->all(); // var_dump($saasIds);exit; // if(!empty($saasIds) && count($saasIds)>0 ){ $query = SaasShareMoney::find()->alias('s')->where(['s.saas_id'=> $saas_id,'s.is_delete'=>0]); $query->leftJoin(['o' => BusinessMemberOrder::tableName()], 'o.id = s.order_id'); $query->select('o.saas_id,o.id order_id,o.member_id,o.pay_price,s.money,o.created_at'); $list = pagination_make($query); if(count($list['list']) > 0 ){ foreach($list['list'] as $key=>$val){ if(isset($val['member_id']) && $val['member_id'] > 0 ){ $businessInfo = BusinessMember::findOne($val['member_id']); if($businessInfo['is_delete']==0){ $list['list'][$key]['businessInfo'] = $businessInfo; }else{ $list['list'][$key]['businessInfo'] = []; } } if(isset($val['saas_id']) && $val['saas_id'] > 0){ $saasInfo = SaasUser::find()->where(['id'=>$val['saas_id'],'is_delete'=>0])->select('name,avatar')->asArray()->one(); $list['list'][$key]['saasInfo'] = $saasInfo; } } } $data['data'] = $list['list']; $data['pageNo'] = $list['pageNo']; $data['totalCount'] = $list['totalCount']; // }else{ // $data['data'] = []; // $data['pageNo'] = 0; // $data['totalCount'] = 0; // } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => $data ]); } /** * 结算明细 */ public function actionDetailedOrder(){ $status = get_params('status',0); //会员分销订单 $saas_id = get_saas_user_id(); //$saas_id = 533; $store_share_type = implode(',', [ SharingReceiver::FROM_AREA_AGENT_PROVIDER, SharingReceiver::FROM_AREA_AGENT_CITY, SharingReceiver::FROM_AREA_AGENT_DISTRICT, SharingReceiver::FROM_BD_AGENT ]); $query = SharingReceiver::find()->alias('sr')->where(['sr.is_delete' => 0]) ->leftJoin(['o' => Order::tableName()], 'sr.order_no = o.order_no AND o.is_delete = 0') ->leftJoin(['sup' => SaasUserPriceLog::tableName()], "sr.order_no = sup.order_no AND sup.saas_id = {$saas_id}") ->leftJoin(['ssm' => StoreShareMoney::tableName()], "o.id = ssm.order_id AND sr.from in ({$store_share_type}) AND ssm.user_id = {$saas_id} ") ->andWhere(['sr.saas_id' => $saas_id]) ->select('sr.id as sr_id, sr.order_no, sr.from, sup.log_type, sup.desc remark, sup.amount, sr.created_at, sup.created_at updated_at, sr.is_pay, sr.amount sharing_amount, sr.remark sharing_remark'); if ($status == 1) {//未到账 $query->andWhere([ 'sr.is_pay' => [0, 2] ]); } if ($status == 2) {//已到账 $query->andWhere([ 'sr.is_pay' => 1 ]); } $query->groupBy(new \yii\db\Expression("IF(sr.from IN (7, 8), IFNULL(ssm.id, 'default'), IFNULL(sup.id, 'default'))")) ->orderBy(new \yii\db\Expression("IF(sr.from IN (7, 8), IFNULL(ssm.id, 'default'), IFNULL(sup.id, 'default')) DESC")); $list = pagination_make($query); foreach ($list['list'] as &$item) { if (!isset($item['log_type'])) { $item['log_type'] = 1; } if (!isset($item['remark'])) { $item['remark'] = $item['sharing_remark']; } if (!isset($item['amount'])) { $item['amount'] = $item['sharing_amount']; } $item['log_type'] = intval($item['log_type']); } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } //佣金明细 public function actionPriceLog() { $log_type = get_params('log_type', 0); $saas_id = get_saas_user_id(); $query = SaasUserPriceLog::find()->where(['saas_id' => $saas_id]); if($log_type){ $query->andWhere(['log_type' => $log_type]); } $query->orderBy('id DESC'); $list = pagination_make($query); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'data' => $list['list'], 'pageNo' => $list['pageNo'], 'totalCount' => $list['totalCount'], ] ]); } /** * @return mixed|string * 获取推广海报 */ public function actionGetQrcode() { $form = new ShareQrcodeForm(); $form->type = 4; $form->user = get_user(); $form->user_id = get_user_id(); $form->saas_id = get_saas_user_id(); $form->store_id = -1; return $this->asJson($form->search()); } }