'/index.php/ShopCoupon/Index/index', 'coupon' => '/index.php/ShopCoupon/Index/createCoupon', 'coupon_info' => '/index.php/ShopCoupon/Index/couponInfo', 'suspendOperation' => '/index.php/ShopCoupon/Index/suspendOperation', 'deleteOperation' => '/index.php/ShopCoupon/Index/deleteOperation', 'record' => '/index.php/ShopCoupon/Index/record', 'download'=>'/index.php/ShopCoupon/Index/downloadCoupon' ]; $authArr = checkFunction($arr); $this->assign('auth', $authArr); $paySetModel = new RetailPaySetModel(); $paySet = $paySetModel->getFindMerchantPaySet($this->merchant_id); $ordinary_pay_state = false; //普通支付模式 $service_pay_state = false; //服务商支付模式 if (!empty($paySet['config']['xcx_mer_id'])) { //普通支付模式 $ordinary_pay_state = true; } if (!empty($paySet['config']['systemConfig']['mch_id'])) { //服务商支付模式 $service_pay_state = true; } $configModel = new RetailMerchantConfigModel(); $config = $configModel->getFind([ 'merchant_id' => $this->merchant_id ], "shop_coupon_simple_image,shop_coupon_service_image"); $url = ($_SERVER['HTTPS'] === 'on' ? 'https://' : 'http://') . $_SERVER['HTTP_HOST']; if (!empty($config['shop_coupon_simple_image'])) { $shop_coupon_simple_image = $url . $config['shop_coupon_simple_image']; } if (!empty($config['shop_coupon_service_image'])) { $shop_coupon_service_image = $url . $config['shop_coupon_service_image']; } $this->assign('local_img', $shop_coupon_simple_image ? $shop_coupon_simple_image : ''); $this->assign('service_img', $shop_coupon_service_image ? $shop_coupon_service_image : ''); $this->assign('ordinary_pay_state', $ordinary_pay_state); $this->assign('service_pay_state', $service_pay_state); $this->display(); } //发放记录 public function record() { $data = I('post.'); $data['merchant_id'] = $this->merchant_id; $ShopCouponRecordClass = new ShopCouponRecord(); $result = $ShopCouponRecordClass->recordList($data); $this->ajaxReturn($result); } //查看详情 public function couponInfo() { $data = I('post.'); $data['merchant_id'] = $this->merchant_id; $ShopCouponRecordClass = new ShopCouponRecord(); $result = $ShopCouponRecordClass->couponInfo($data); $this->ajaxReturn($result); } //删除 public function deleteOperation() { $data = I("post."); $data['operation_type'] = 3; $data['merchant_id'] = $this->merchant_id; $ShopCouponClass = new ShopCoupon(); $result = $ShopCouponClass->suspendOperation($data); $this->ajaxReturn($result); } //暂停或者发放或者删除 public function suspendOperation() { $data = I("post."); $data['merchant_id'] = $this->merchant_id; $ShopCouponClass = new ShopCoupon(); $result = $ShopCouponClass->suspendOperation($data); if ($result['status'] == 1) { switch ($data['operation_type']) { case 1: $desc = "发放商家券"; break; case 2: $desc = "暂停商家券"; break; case 3: $desc = "删除商家券"; break; } $param = [ 'source' => 0, 'type' => 3, 'request_data' => $_POST, 'desc' => $desc ]; action_log_v2($param); } $this->ajaxReturn($result); } //创建商家券 public function createCoupon() { $data = json_decode(I('post.add_form'), true); $ShopCouponClass = new ShopCoupon(); $result = $ShopCouponClass->createCoupon([ 'merchant_id' => $this->merchant_id, 'operator_id' => session("jurisdiction_user")['id'], 'data' => $data ]); if ($result['status'] == 1) { $param = [ 'source' => 0, 'type' => 3, 'request_data' => $_POST, 'desc' => '创建商家券' ]; action_log_v2($param); } $this->ajaxReturn($result); } //商家券列表 public function CouponList() { $data = I("post."); $data['merchant_id'] = $this->merchant_id; $ShopCouponRecordClass = new ShopCouponRecord(); $result = $ShopCouponRecordClass->couponList($data); $this->ajaxReturn($result); } //门店商品列表 public function storeGoodsList() { $data = I("post."); $goodsClass = new Goods(); $result = $goodsClass->getStoreGoodsList($data); $this->ajaxReturn($result); } //分类 public function getGoodsClass1() { $goodsClass = new GoodsClassify(); $result = $goodsClass->getGoodsClassTopLevel($this->merchant_id); $this->ajaxReturn($result); } //门店列表 public function store() { $shopCouponRecordClass = new ShopCouponRecord(); $result = $shopCouponRecordClass->getStoreList([ 'merchant_id' => $this->merchant_id ]); $this->ajaxReturn($result); } /** * 上传Logo */ public function uploadWx() { $data = I('post.'); $payCouponClass = new ShopCoupon(); $result = $payCouponClass->wxUpload([ 'merchant_id' => $this->merchant_id, 'user_type' => $data['user_type'] ]); $this->ajaxReturn($result); } //下载券码 public function downloadCoupon() { ini_set('memory_limit', -1); $data = I('post.'); $data['merchant_id'] = $this->merchant_id; $ShopCouponClass = new ShopCoupon(); $result = $ShopCouponClass->downloadCouponCode($data); $this->ajaxReturn($result); } //下载券码压缩包 public function downloadCouponZip() { ini_set('memory_limit', -1); $data = I('get.'); $data['zip_name'] = 'sjq'; $data['file_type'] = 'jpg'; $data['store_arr'] = json_decode($data['store_arr'], true); $data['file_name_arr'] = json_decode($data['coupon_arr'], true); $DownFileClass = new DownFile(); $DownFileClass->downloadZip($data); } }