|
- <?php
- namespace backend\modules\zzcs\controllers;
-
- use backend\modules\zzcs\logic\ChannelManage;
- use Yii;
- use yii\web\Controller;
-
- class ChannelController extends Controller
- {
- public $layout = '@backend/modules/zzcs/views/layouts/zzcs';
- public $enableCsrfValidation = false;
- private $service = null;
-
- /**
- * Des:逻辑处理类型
- * Name: logic
- * @return ChannelManage
- * @author 倪宗锋
- */
- private function logic()
- {
- if ($this->service == null) {
- $this->service = new ChannelManage();
- }
- return $this->service;
- }
-
- /**
- * Function Description:初始化页面
- * Function Name: actionIndex
- *
- * @return string
- *
- * @author 李健
- */
- public function actionIndex()
- {
- return $this->render('channel_list');
- }
-
- /**
- * Function Description:加载页面数据
- * Function Name: actionGetChannelList
- *
- * @return string
- *
- * @author 李健
- */
- public function actionGetChannelList()
- {
- $params = [
- 'page_size' => Yii::$app->request->get('page_size', '10'),//每页展示条数
- 'current_page' => Yii::$app->request->get('current', 1),//当前页
- 'product_type' => Yii::$app->request->get('product_type', ''),//销售范围
- 'supplier_name' => Yii::$app->request->get('supplier_name', ''),//供应商
- 'is_disabled' => Yii::$app->request->get('is_disabled', 0),//状态
- ];
- $getList = $this->logic()->getList($params);
- return json_encode($getList);
- }
-
- /**
- * Function Description:获取页面
- * Function Name: actionAddChannelPage
- *
- * @return string
- *
- * @author 李健
- */
- public function actionAddChannelPage()
- {
- return $this->render('add_channel');
- }
-
-
- /**
- * Function Description:添加渠道商
- * Function Name: actionAddChannel
- *
- * @return string
- *
- * @author 李健
- */
- public function actionAddChannel()
- {
- $supplier_name = trim(Yii::$app->request->post('supplier_name'));//渠道商名称
- $area_id = trim(Yii::$app->request->post('area_id'));//所属区域市id
- $manage_type = trim(Yii::$app->request->post('manage_type'));//经营性质 1:公司 2:个人
- $company_name = trim(Yii::$app->request->post('company_name'));//公司名称
- $id_card = trim(Yii::$app->request->post('id_card'));//身份证号(企业传空)
- $sale = trim(Yii::$app->request->post('sale'));//销售方式
- $sett_type = trim(Yii::$app->request->post('sett_type'));//结算方式 (授信:275,预付:288,单结:292)
- $sett_frequency = trim(Yii::$app->request->post('sett_frequency'));//结算周期(日结:293,周结:294,月结:295)
- $account_bank = trim(Yii::$app->request->post('account_bank'));//开户银行
- $account_num = trim(Yii::$app->request->post('account_num'));//银行账号
- $account_name = trim(Yii::$app->request->post('account_name'));//账号名称
- $link_info = trim(Yii::$app->request->post('link_info'));//联系人详情
- $sales_man = trim(Yii::$app->request->post('sales_man'));//业务员
- $deduct_type = trim(Yii::$app->request->post('deduct_type')); // 扣款口径
- $alert_balance = trim(Yii::$app->request->post('alert_balance')); // 预警金额
- $link_arr = json_decode(Yii::$app->request->post('link_array'), true);
- $sale_arr = json_decode(Yii::$app->request->post('sale_array'), true);
-
- $params = [
- 'supplier_name' => $supplier_name,//渠道商名称
- 'area_id' => $area_id,//所属区域市id
- 'manage_type' => $manage_type,//经营性质 1:公司 2:个人
- 'company_name' => $company_name,//公司名称
- 'id_card' => $id_card,//身份证号(企业传空)
- 'sale' => $sale,//销售方式
- 'sett_type' => $sett_type,//结算方式 (授信:275,预付:288,单结:292)
- 'sett_frequency' => $sett_frequency,//结算周期(日结:293,周结:294,月结:295)
- 'account_bank' => $account_bank,//开户银行
- 'account_num' => $account_num,//银行账号
- 'account_name' => $account_name,//账号名称
- 'link_info' => $link_info,//联系人详情
- 'sales_man' => $sales_man,//业务员
- 'deduct_type' => $deduct_type, // 扣款口径
- 'alert_balance' => $alert_balance, // 预警金额
- 'link_arr' => $link_arr,
- 'sale_arr' => $sale_arr,
- ];
-
- $json = $this->logic()->addChannel($params);
- return json_encode($json);
- }
-
- /**
- * Function Description:获取地区
- * Function Name: actionGetArea
- *
- * @return string
- *
- * @author 李健
- */
- public function actionGetArea()
- {
- $area_id = trim(Yii::$app->request->post('area_id'));
- $json = $this->logic()->getArea($area_id);
- return json_encode($json);
- }
-
- /**
- * Function Description:检查
- * Function Name: actionCheck
- *
- * @return string
- *
- * @author 李健
- */
- public function actionCheck()
- {
- $supplier_type = trim(Yii::$app->request->post('supplier_type'));
- $supplier_name = trim(Yii::$app->request->post('supplier_name'));
- $supplier_id = trim(Yii::$app->request->post('supplier_id'));
- $json = $this->logic()->checkInfo($supplier_type,$supplier_name,$supplier_id);
- return json_encode($json);
- }
-
- /**
- * Function Description:跳转修改渠道商页面
- * Function Name: actionAmendChannelPage
- *
- * @return string
- *
- * @author 李健
- */
- public function actionAmendChannelPage()
- {
- //$iprod_id = Yii::$app->request->get('iprod_id');
- return $this->render('amend_channel');
- }
-
- /**
- * Function Description:获取渠道商信息
- * Function Name: actionGetChannelInfo
- *
- * @return string
- *
- * @author 李健
- */
- public function actionGetChannelInfo()
- {
- $channel_id = Yii::$app->request->post('channel_id');
- $data = $this->logic()->getChannelInfo($channel_id);
-
- return json_encode($data);
- }
-
- /**
- * Function Description:修改渠道商
- * Function Name: actionUptChannel
- *
- * @return string
- *
- * @author 李健
- */
- public function actionUptChannel()
- {
- $channel_id = trim(Yii::$app->request->post('channel_id'));//渠道商名称
- $supplier_name = trim(Yii::$app->request->post('supplier_name'));//渠道商名称
- $area_id = trim(Yii::$app->request->post('area_id'));//所属区域市id
- $manage_type = trim(Yii::$app->request->post('manage_type'));//经营性质 1:公司 2:个人
- $company_name = trim(Yii::$app->request->post('company_name'));//公司名称
- $id_card = trim(Yii::$app->request->post('id_card'));//身份证号(企业传空)
- $sale = trim(Yii::$app->request->post('sale'));//销售方式
- $sett_type = trim(Yii::$app->request->post('sett_type'));//结算方式 (授信:275,预付:288,单结:292)
- $sett_frequency = trim(Yii::$app->request->post('sett_frequency'));//结算周期(日结:293,周结:294,月结:295)
- $account_bank = trim(Yii::$app->request->post('account_bank'));//开户银行
- $account_num = trim(Yii::$app->request->post('account_num'));//银行账号
- $account_name = trim(Yii::$app->request->post('account_name'));//账号名称
- $link_info = trim(Yii::$app->request->post('link_info'));//联系人详情
- $sales_man = trim(Yii::$app->request->post('sales_man'));//业务员
- $deduct_type = trim(Yii::$app->request->post('deduct_type'));
- $alert_balance = trim(Yii::$app->request->post('alert_balance'));
- $link_arr = json_decode(Yii::$app->request->post('link_array'), true);
- $sale_arr = json_decode(Yii::$app->request->post('sale_array'), true);
-
- $params = [
- 'channel_id' => $channel_id,//渠道商名称
- 'supplier_name' => $supplier_name,//渠道商名称
- 'area_id' => $area_id,//所属区域市id
- 'manage_type' => $manage_type,//经营性质 1:公司 2:个人
- 'company_name' => $company_name,//公司名称
- 'id_card' => $id_card,//身份证号(企业传空)
- 'sale' => $sale,//销售方式
- 'sett_type' => $sett_type,//结算方式 (授信:275,预付:288,单结:292)
- 'sett_frequency' => $sett_frequency,//结算周期(日结:293,周结:294,月结:295)
- 'account_bank' => $account_bank,//开户银行
- 'account_num' => $account_num,//银行账号
- 'account_name' => $account_name,//账号名称
- 'link_info' => $link_info,//联系人详情
- 'sales_man' => $sales_man,//业务员
- 'deduct_type' => $deduct_type,
- 'alert_balance' => $alert_balance,
- 'link_arr' => $link_arr,
- 'sale_arr' => $sale_arr,
- ];
-
- $json = $this->logic()->uptChannel($params);
- return json_encode($json);
- }
-
- /**
- * Function Description:修改状态
- * Function Name: actionChangeStatus
- *
- * @return string
- *
- * @author 李健
- */
- public function actionChangeStatus()
- {
- $channel_id= trim(Yii::$app->request->post('channel_id'));
- $play = trim(Yii::$app->request->post('play'));
-
- $json = $this->logic()->changeStatus($channel_id,$play);
- return json_encode($json);
- }
-
- /**
- * Function Description:获取账户信息
- * Function Name: actionAccountListPage
- *
- * @return string
- *
- * @author 李健
- */
- public function actionAccountListPage()
- {
- return $this->render('account_list');
- }
-
- /**
- * Function Description:跳转添加账户页面
- * Function Name: actionAddAccountPage
- *
- * @return string
- *
- * @author 李健
- */
- public function actionAddAccountPage()
- {
- return $this->render('add_account');
- }
-
- /**
- * Function Description:跳转修改账户页面
- * Function Name: actionChangeAccountPage
- *
- * @return string
- *
- * @author 李健
- */
- public function actionChangeAccountPage()
- {
- return $this->render('change_account');
- }
-
- /**
- * Function Description:账户管理
- * Function Name: actionAccount
- *
- * @return string
- *
- * @author 李健
- */
- public function actionAccount()
- {
- $operate = trim(Yii::$app->request->post('operate'));
- $supplier_id = trim(Yii::$app->request->post('supplier_id'));//供应商或渠道商id
- $user_name = trim(Yii::$app->request->post('user_name'));//用户名
- $true_name = trim(Yii::$app->request->post('true_name'));//真实姓名
- $phone_no = trim(Yii::$app->request->post('phone_no'));//手机号
- $user_id = trim(Yii::$app->request->post('user_id'));//用户id
-
- $json = $this->logic()->dealAccount($operate,$supplier_id,$user_name,$true_name,$phone_no,$user_id);
-
- return json_encode($json);
- }
- }
|