From 137962ccf2a0be7b33f93b7af976b22ddbb7cf25 Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Thu, 16 May 2019 14:29:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=AC=E4=BC=97=E5=8F=B7?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/wap/controller/Article.php | 4 +- application/wap/controller/AuthApi.php | 18 ++-- application/wap/controller/AuthController.php | 1 - application/wap/controller/Index.php | 7 +- application/wap/controller/Login.php | 4 +- application/wap/controller/My.php | 4 +- application/wap/controller/PublicApi.php | 33 +++++++- application/wap/controller/Service.php | 1 - application/wap/controller/Store.php | 7 +- application/wap/controller/Wechat.php | 4 +- application/wap/model/store/StoreOrder.php | 20 ++--- application/wap/model/user/User.php | 11 ++- application/wap/model/user/UserExtract.php | 4 +- application/wap/model/user/UserRecharge.php | 4 +- application/wap/model/user/UserSign.php | 4 +- application/wap/model/user/WechatUser.php | 14 +++- application/wap/view/first/index/about.html | 4 +- application/wap/view/first/index/index.html | 83 ++++++++++++++++++- application/wap/view/first/index/spread.html | 8 +- application/wap/view/first/my/index.html | 31 ++++--- application/wap/view/first/my/order_list.html | 5 +- .../wap/view/first/public/container.html | 8 +- .../wap/view/first/public/requirejs.html | 8 +- 23 files changed, 208 insertions(+), 79 deletions(-) diff --git a/application/wap/controller/Article.php b/application/wap/controller/Article.php index 0f87472e..fba5738a 100644 --- a/application/wap/controller/Article.php +++ b/application/wap/controller/Article.php @@ -4,7 +4,6 @@ namespace app\wap\controller; use app\admin\model\article\Article as ArticleModel; use app\wap\model\wap\ArticleCategory; -use basic\WapBasic; use think\Db; /** @@ -37,8 +36,7 @@ class Article extends WapBasic { public function visit($id = '') { - $content = ArticleModel::where('status',1)->where('hide',0)->where('id',$id)->order('id desc')->find(); - + $content = ArticleModel::where('status',1)->where('hide',0)->where('id',$id)->find(); if(!$content || !$content["status"]) return $this->failed('此文章已经不存在!'); $content["content"] = Db::name('articleContent')->where('nid',$content["id"])->value('content'); //增加浏览次数 diff --git a/application/wap/controller/AuthApi.php b/application/wap/controller/AuthApi.php index ab036566..a841d481 100644 --- a/application/wap/controller/AuthApi.php +++ b/application/wap/controller/AuthApi.php @@ -35,13 +35,12 @@ use app\wap\model\user\UserNotice; use app\wap\model\user\UserSign; use app\wap\model\user\WechatUser; use behavior\wap\StoreProductBehavior; -use service\WechatTemplateService; +use app\core\util\WechatTemplateService; use service\CacheService; use service\HookService; use service\JsonService; -use service\SystemConfigService; +use app\core\util\SystemConfigService; use service\UtilService; -use service\WechatService; use think\Cache; use think\Request; use think\Url; @@ -312,7 +311,7 @@ class AuthApi extends AuthController $order = StoreOrder::searchUserOrder($this->userInfo['uid'],$search)?:[]; $list = $order == false ? [] : [$order]; }else{ - if($type == 'first') $type = ''; + if(!is_numeric($type)) $type = ''; $list = StoreOrder::getUserOrderList($this->userInfo['uid'],$type,$first,$limit); } foreach ($list as $k=>$order){ @@ -484,10 +483,17 @@ class AuthApi extends AuthController public function get_product_list($keyword = '', $cId = 0,$sId = 0,$priceOrder = '', $salesOrder = '', $news = 0, $first = 0, $limit = 8) { - if(!empty($keyword)) $keyword = base64_decode(htmlspecialchars($keyword)); + if(!empty($keyword)){ + $encodedData = str_replace(' ','+',$keyword); + $keyword = base64_decode(htmlspecialchars($encodedData)); + } $model = StoreProduct::validWhere(); if($cId && $sId){ - $model->where('cate_id',$sId); + $product_ids=\think\Db::name('store_product_cate')->where('cate_id',$sId)->column('product_id'); + if(count($product_ids)) + $model=$model->where('id',"in",$product_ids); + else + $model=$model->where('cate_id',-1); }elseif($cId){ $sids = StoreCategory::pidBySidList($cId)?:[]; $sids[] = $cId; diff --git a/application/wap/controller/AuthController.php b/application/wap/controller/AuthController.php index b6b41b5b..53ba0c8c 100644 --- a/application/wap/controller/AuthController.php +++ b/application/wap/controller/AuthController.php @@ -11,7 +11,6 @@ namespace app\wap\controller; use app\wap\model\store\StoreOrder; use app\wap\model\user\User; use app\wap\model\user\WechatUser; -use basic\WapBasic; use service\UtilService; use think\Cookie; use think\Session; diff --git a/application/wap/controller/Index.php b/application/wap/controller/Index.php index af02eae6..4f776f8a 100644 --- a/application/wap/controller/Index.php +++ b/application/wap/controller/Index.php @@ -17,10 +17,9 @@ use app\wap\model\user\User; use app\wap\model\user\UserNotice; use app\wap\model\user\WechatUser; use basic\WapBasic; -use service\GroupDataService; -use service\QrcodeService; -use service\SystemConfigService; -use service\WechatService; +use app\core\util\GroupDataService; +use app\core\util\QrcodeService; +use app\core\util\SystemConfigService; use think\Db; use think\Url; diff --git a/application/wap/controller/Login.php b/application/wap/controller/Login.php index 0af7b741..cf0ca319 100644 --- a/application/wap/controller/Login.php +++ b/application/wap/controller/Login.php @@ -10,9 +10,7 @@ namespace app\wap\controller; use app\wap\model\user\User; use app\wap\model\user\WechatUser; -use basic\WapBasic; use service\UtilService; -use service\WechatService; use think\Cookie; use think\Request; use think\Session; @@ -23,7 +21,7 @@ class Login extends WapBasic public function index($ref = '') { Cookie::set('is_bg',1); - $ref && $ref=htmlspecialchars(base64_decode($ref)); + $ref && $ref=htmlspecialchars_decode(base64_decode($ref)); if(UtilService::isWechatBrowser()){ $this->_logout(); $openid = $this->oauth(); diff --git a/application/wap/controller/My.php b/application/wap/controller/My.php index 67573d3e..b2721b35 100644 --- a/application/wap/controller/My.php +++ b/application/wap/controller/My.php @@ -24,11 +24,11 @@ use app\wap\model\user\User; use app\wap\model\user\UserBill; use app\wap\model\user\UserExtract; use app\wap\model\user\UserNotice; -use service\GroupDataService; +use app\core\util\GroupDataService; use app\wap\model\user\UserAddress; use app\wap\model\user\UserSign; use service\CacheService; -use service\SystemConfigService; +use app\core\util\SystemConfigService; use think\Request; use think\Url; diff --git a/application/wap/controller/PublicApi.php b/application/wap/controller/PublicApi.php index c37a21e2..c849ab0b 100644 --- a/application/wap/controller/PublicApi.php +++ b/application/wap/controller/PublicApi.php @@ -15,6 +15,7 @@ use app\wap\model\store\StoreCategory; use app\wap\model\store\StoreCouponIssue; use app\wap\model\store\StoreProduct; use app\wap\model\wap\ArticleCategory; +use service\FileService; use service\JsonService; use service\UtilService; use think\Cache; @@ -68,6 +69,30 @@ class PublicApi return JsonService::successful($result); } + /** 首页获取推荐产品 + * @param int $first + * @param int $limit + */ + public function get_product_list($first = 0,$limit = 8) + { + $StoreProductmodel = StoreProduct::validWhere(); + if(input('type')=='is_best') + $StoreProductmodel = $StoreProductmodel->where('is_best',1); + if(input('type')=='is_hot') + $StoreProductmodel = $StoreProductmodel->where('is_hot',1); + if(input('type')=='is_benefit') + $StoreProductmodel = $StoreProductmodel->where('is_benefit',1); + if(input('type')=='is_new') + $StoreProductmodel = $StoreProductmodel->where('is_new',1); + if(input('type')=='is_postage') + $StoreProductmodel = $StoreProductmodel->where('is_postage',1); + + $list = $StoreProductmodel->where('mer_id',0)->order('is_best DESC,sort DESC,add_time DESC') + ->limit($first,$limit)->field('id,image,store_name,sales,price,unit_name')->select()->toArray(); + + return JsonService::successful($list); + } + public function get_best_product_list($first = 0,$limit = 8) { $list = StoreProduct::validWhere()->where('mer_id',0)->order('is_best DESC,sort DESC,add_time DESC') @@ -79,8 +104,9 @@ class PublicApi { if(!$mediaIds) return JsonService::fail('参数错误'); $mediaIds = explode(',',$mediaIds); - $temporary = \service\WechatService::materialTemporaryService(); + $temporary = \app\core\util\WechatService::materialTemporaryService(); $pathList = []; + $dir='public'.DS.'uploads'.DS.'wechat'.DS.'media'; foreach ($mediaIds as $mediaId){ if(!$mediaId) continue; try{ @@ -89,7 +115,10 @@ class PublicApi continue; } $name = substr(md5($mediaId),12,20).'.jpg'; - $path = '.'.DS.'public'.DS.'uploads'.DS.'wechat'.DS.'media'.DS.$name; + $path = '.'.DS.$dir.DS.$name; + $file=new FileService(); + $res=$file->create_dir($dir); + if(!$res) return JsonService::fail('生成文件保存目录失败!请检查权限!'); $res = file_put_contents($path,$content); if($res) $pathList[] = UtilService::pathToUrl($path); } diff --git a/application/wap/controller/Service.php b/application/wap/controller/Service.php index 51312ec8..84d14245 100644 --- a/application/wap/controller/Service.php +++ b/application/wap/controller/Service.php @@ -8,7 +8,6 @@ namespace app\wap\controller; use app\wap\model\store\StoreService; -use service\SystemConfigService; use app\wap\model\user\User; use app\admin\model\system\Merchant; use think\Request; diff --git a/application/wap/controller/Store.php b/application/wap/controller/Store.php index 488c7904..39c7aa6e 100644 --- a/application/wap/controller/Store.php +++ b/application/wap/controller/Store.php @@ -28,8 +28,8 @@ use app\wap\model\store\StoreProductRelation; use app\wap\model\user\User; use app\wap\model\user\WechatUser; use app\wap\model\store\StoreCombination; -use service\GroupDataService; -use service\SystemConfigService; +use app\core\util\GroupDataService; +use app\core\util\SystemConfigService; use service\UtilService; use think\Cache; use think\Request; @@ -311,6 +311,7 @@ class Store extends AuthController 'site'=>SystemConfigService::more(['wechat_qrcode','wechat_name','wechat_avatar']), 'isFollow'=>$isFollow ]); +// var_dump(SystemConfigService::more(['wechat_qrcode','wechat_name','wechat_avatar']));die; return $this->fetch(); } @@ -329,7 +330,7 @@ class Store extends AuthController //砍价产品 $bargain = StoreBargain::getBargainTerm($id); $bargain['time'] = time(); - $description = htmlspecialchars_decode($bargain['description']); + $description = isset($bargain['description'])?htmlspecialchars_decode($bargain['description']):''; $rule = isset($bargain['rule']) ? htmlspecialchars_decode($bargain['rule']) : ''; if(!$bargainUid) //判断当前登录人是不是砍价 diff --git a/application/wap/controller/Wechat.php b/application/wap/controller/Wechat.php index e802cce8..834d970f 100755 --- a/application/wap/controller/Wechat.php +++ b/application/wap/controller/Wechat.php @@ -2,7 +2,7 @@ namespace app\wap\controller; use app\admin\model\wechat\WechatReply; -use service\WechatService; +use app\core\util\WechatService; /** @@ -32,7 +32,7 @@ class Wechat public function text() { - dump(WechatService::userGroupService()); + //dump(WechatService::userGroupService()); } diff --git a/application/wap/model/store/StoreOrder.php b/application/wap/model/store/StoreOrder.php index 7b0ffbc5..8442be4f 100644 --- a/application/wap/model/store/StoreOrder.php +++ b/application/wap/model/store/StoreOrder.php @@ -21,10 +21,10 @@ use behavior\wap\StoreProductBehavior; use behavior\wechat\PaymentBehavior; use service\HookService; use service\JsonService; -use service\SystemConfigService; +use app\core\util\SystemConfigService; use service\UtilService; -use service\WechatService; -use service\WechatTemplateService; +use app\core\util\WechatService; +use app\core\util\WechatTemplateService; use think\Cache; use think\Db; use think\Request; @@ -58,8 +58,8 @@ class StoreOrder extends ModelBasic public static function getOrderPriceGroup($cartInfo) { - $storePostage = floatval(SystemConfigService::get('store_postage'))?:0;//基础邮费 - $storeFreePostage = floatval(SystemConfigService::get('store_free_postage'))?:0;//满*包邮 + $storePostage = floatval(SystemConfigService::get('store_postage'))?:0; + $storeFreePostage = floatval(SystemConfigService::get('store_free_postage'))?:0; $totalPrice = self::getOrderTotalPrice($cartInfo); $costPrice = self::getOrderCostPrice($cartInfo); if(!$storeFreePostage) { @@ -213,7 +213,7 @@ class StoreOrder extends ModelBasic $res2 = false !== User::bcDec($userInfo['uid'],'integral',$usedIntegral,'uid'); $payPrice = 0; } - $res2 = $res2 && false != UserBill::expend('积分抵扣',$uid,'integral','deduction',$usedIntegral,$key,$userInfo['integral'],'购买商品使用'.floatval($usedIntegral).'积分抵扣'.floatval($deductionPrice).'元'); + $res2 = $res2 && false != UserBill::expend('积分抵扣',$uid,'integral','deduction',$usedIntegral,$key,bcsub($userInfo['integral'],$usedIntegral,2),'购买商品使用'.floatval($usedIntegral).'积分抵扣'.floatval($deductionPrice).'元'); }else{ $deductionPrice = 0; $usedIntegral = 0; @@ -319,7 +319,7 @@ class StoreOrder extends ModelBasic return self::setErrorInfo('余额不足'.floatval($orderInfo['pay_price'])); self::beginTrans(); $res1 = false !== User::bcDec($uid,'now_money',$orderInfo['pay_price'],'uid'); - $res2 = UserBill::expend('购买商品',$uid,'now_money','pay_product',$orderInfo['pay_price'],$orderInfo['id'],$userInfo['now_money'],'余额支付'.floatval($orderInfo['pay_price']).'元购买商品'); + $res2 = UserBill::expend('购买商品',$uid,'now_money','pay_product',$orderInfo['pay_price'],$orderInfo['id'],bcsub($userInfo['now_money'],$orderInfo['pay_price'],2),'余额支付'.floatval($orderInfo['pay_price']).'元购买商品'); $res3 = self::paySuccess($order_id); try{ HookService::listen('yue_pay_product',$userInfo,$orderInfo,false,PaymentBehavior::class); @@ -481,7 +481,7 @@ class StoreOrder extends ModelBasic { $openid = WechatUser::uidToOpenid($order['uid']); WechatTemplateService::sendTemplate($openid,WechatTemplateService::ORDER_TAKE_SUCCESS,[ - 'first'=>'亲,您的订单以成功签收,快去评价一下吧', + 'first'=>'亲,您的订单已成功签收,快去评价一下吧', 'keyword1'=>$order['order_id'], 'keyword2'=>'已收货', 'keyword3'=>date('Y/m/d H:i',time()), @@ -684,7 +684,7 @@ class StoreOrder extends ModelBasic $noBuy = self::where('uid',$uid)->where('paid',0)->where('is_del',0)->where('pay_type','<>','offline')->where('refund_status',0)->count(); $noPostageNoPink = self::where('o.uid',$uid)->alias('o')->where('o.paid',1)->where('o.pink_id',0)->where('o.is_del',0)->where('o.status',0)->where('o.pay_type','<>','offline')->where('o.refund_status',0)->count(); $noPostageYesPink = self::where('o.uid',$uid)->alias('o')->join('StorePink p','o.pink_id = p.id')->where('p.status',2)->where('o.paid',1)->where('o.is_del',0)->where('o.status',0)->where('o.refund_status',0)->where('o.pay_type','<>','offline')->count(); - $noPostage = bcadd($noPostageNoPink,$noPostageYesPink); + $noPostage = bcadd($noPostageNoPink,$noPostageYesPink,0); $noTake = self::where('uid',$uid)->where('paid',1)->where('is_del',0)->where('status',1)->where('pay_type','<>','offline')->where('refund_status',0)->count(); $noReply = self::where('uid',$uid)->where('paid',1)->where('is_del',0)->where('status',2)->where('refund_status',0)->count(); $noPink = self::where('o.uid',$uid)->alias('o')->join('StorePink p','o.pink_id = p.id')->where('p.status',1)->where('o.paid',1)->where('o.is_del',0)->where('o.status',0)->where('o.pay_type','<>','offline')->where('o.refund_status',0)->count(); @@ -697,7 +697,7 @@ class StoreOrder extends ModelBasic $userInfo = User::getUserInfo($order['uid']); ModelBasic::beginTrans(); $res1 = false != User::where('uid',$userInfo['uid'])->update(['integral'=>bcadd($userInfo['integral'],$order['gain_integral'],2)]); - $res2 = false != UserBill::income('购买商品赠送积分',$order['uid'],'integral','gain',$order['gain_integral'],$order['id'],$userInfo['integral'],'购买商品赠送'.floatval($order['gain_integral']).'积分'); + $res2 = false != UserBill::income('购买商品赠送积分',$order['uid'],'integral','gain',$order['gain_integral'],$order['id'],bcadd($userInfo['integral'],$order['gain_integral'],2),'购买商品赠送'.floatval($order['gain_integral']).'积分'); $res = $res1 && $res2; ModelBasic::checkTrans($res); return $res; diff --git a/application/wap/model/user/User.php b/application/wap/model/user/User.php index 8b9199c7..b10a0b9c 100644 --- a/application/wap/model/user/User.php +++ b/application/wap/model/user/User.php @@ -9,7 +9,7 @@ namespace app\wap\model\user; use basic\ModelBasic; -use service\SystemConfigService; +use app\core\util\SystemConfigService; use think\Request; use think\response\Redirect; use think\Session; @@ -108,10 +108,13 @@ class User extends ModelBasic $cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价 if($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回 $brokeragePrice = bcmul(bcsub($orderInfo['pay_price'],$cost,2),$brokerageRatio,2); + //返佣之后余额 + $orderInfo['pay_price'] = bcsub($orderInfo['pay_price'],$orderInfo['pay_postage'],2); + $balance = bcsub($userInfo['now_money'],$brokeragePrice,2); if($brokeragePrice <= 0) return true; $mark = $userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice); self::beginTrans(); - $res1 = UserBill::income('获得推广佣金',$userInfo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],0,$mark); + $res1 = UserBill::income('获得推广佣金',$userInfo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],$balance,$mark); $res2 = self::bcInc($userInfo['spread_uid'],'now_money',$brokeragePrice,'uid'); $res = $res1 && $res2; self::checkTrans($res); @@ -137,10 +140,12 @@ class User extends ModelBasic $cost = isset($orderInfo['cost']) ? $orderInfo['cost'] : 0;//成本价 if($cost > $orderInfo['pay_price']) return true;//成本价大于支付价格时直接返回 $brokeragePrice = bcmul(bcsub($orderInfo['pay_price'],$cost,2),$brokerageRatio,2); + //返佣之后余额 + $balance = bcsub($userInfo['now_money'],$brokeragePrice,2); if($brokeragePrice <= 0) return true; $mark = '二级推广人'.$userInfo['nickname'].'成功消费'.floatval($orderInfo['pay_price']).'元,奖励推广佣金'.floatval($brokeragePrice); self::beginTrans(); - $res1 = UserBill::income('获得推广佣金',$userInfoTwo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],0,$mark); + $res1 = UserBill::income('获得推广佣金',$userInfoTwo['spread_uid'],'now_money','brokerage',$brokeragePrice,$orderInfo['id'],$balance,$mark); $res2 = self::bcInc($userInfoTwo['spread_uid'],'now_money',$brokeragePrice,'uid'); $res = $res1 && $res2; self::checkTrans($res); diff --git a/application/wap/model/user/UserExtract.php b/application/wap/model/user/UserExtract.php index 1a4926e8..44f49c27 100644 --- a/application/wap/model/user/UserExtract.php +++ b/application/wap/model/user/UserExtract.php @@ -9,8 +9,8 @@ namespace app\wap\model\user; use basic\ModelBasic; -use service\SystemConfigService; -use service\WechatTemplateService; +use app\core\util\SystemConfigService; +use app\core\util\WechatTemplateService; use think\Url; use traits\ModelTrait; diff --git a/application/wap/model/user/UserRecharge.php b/application/wap/model/user/UserRecharge.php index bde6c671..692ad83a 100644 --- a/application/wap/model/user/UserRecharge.php +++ b/application/wap/model/user/UserRecharge.php @@ -9,7 +9,7 @@ namespace app\wap\model\user; use app\wap\model\user\WechatUser; use basic\ModelBasic; -use service\WechatService; +use app\core\util\WechatService; use traits\ModelTrait; class UserRecharge extends ModelBasic @@ -51,7 +51,7 @@ class UserRecharge extends ModelBasic $user = User::getUserInfo($order['uid']); self::beginTrans(); $res1 = self::where('order_id',$order['order_id'])->update(['paid'=>1,'pay_time'=>time()]); - $res2 = UserBill::income('用户余额充值',$order['uid'],'now_money','recharge',$order['price'],$order['id'],$user['now_money'],'成功充值余额'.floatval($order['price']).'元'); + $res2 = UserBill::income('用户余额充值',$order['uid'],'now_money','recharge',$order['price'],$order['id'],bcadd($user['now_money'],$order['price'],2),'成功充值余额'.floatval($order['price']).'元'); $res3 = User::edit(['now_money'=>bcadd($user['now_money'],$order['price'],2)],$order['uid'],'uid'); $res = $res1 && $res2 && $res3; self::checkTrans($res); diff --git a/application/wap/model/user/UserSign.php b/application/wap/model/user/UserSign.php index ff6493ee..9dbe0822 100644 --- a/application/wap/model/user/UserSign.php +++ b/application/wap/model/user/UserSign.php @@ -9,7 +9,7 @@ namespace app\wap\model\user; use basic\ModelBasic; -use service\SystemConfigService; +use app\core\util\SystemConfigService; use think\Model; class UserSign @@ -40,7 +40,7 @@ class UserSign $max = SystemConfigService::get('sx_sign_max_int')?:5; $integral = rand($min,$max); ModelBasic::beginTrans(); - $res1 = UserBill::income('用户签到',$uid,'integral','sign',$integral,0,$userInfo['integral'],'签到获得'.floatval($integral).'积分'); + $res1 = UserBill::income('用户签到',$uid,'integral','sign',$integral,0,bcadd($userInfo['integral'],$integral,2),'签到获得'.floatval($integral).'积分'); $res2 = User::bcInc($uid,'integral',$integral,'uid'); $res = $res1 && $res2; ModelBasic::checkTrans($res); diff --git a/application/wap/model/user/WechatUser.php b/application/wap/model/user/WechatUser.php index dcf4e623..6563e2b1 100644 --- a/application/wap/model/user/WechatUser.php +++ b/application/wap/model/user/WechatUser.php @@ -10,9 +10,9 @@ namespace app\wap\model\user; use app\wap\model\store\StoreCoupon; use app\wap\model\store\StoreCouponUser; use basic\ModelBasic; -use service\SystemConfigService; +use app\core\util\SystemConfigService; use service\UtilService; -use service\WechatService; +use app\core\util\WechatService; use service\CacheService as Cache; use think\Session; use traits\ModelTrait; @@ -39,6 +39,13 @@ class WechatUser extends ModelBasic if(!isset($userInfo['subscribe']) || !$userInfo['subscribe'] || !isset($userInfo['openid'])) exception('请关注公众号!'); $userInfo['tagid_list'] = implode(',',$userInfo['tagid_list']); + //判断 unionid 是否存在 + if(isset($userInfo['unionid'])){ + $wechatInfo = self::where('unionid',$userInfo['unionid'])->find(); + if($wechatInfo){ + return self::edit($userInfo,$userInfo['unionid'],'unionid'); + } + } self::beginTrans(); $wechatUser = self::set($userInfo); if(!$wechatUser){ @@ -54,6 +61,9 @@ class WechatUser extends ModelBasic return $wechatUser; } + /**关注送优惠券 + * @param $openid + */ public static function userFirstSubGiveCoupon($openid) { $couponId = SystemConfigService::get('wechat_first_sub_give_coupon'); diff --git a/application/wap/view/first/index/about.html b/application/wap/view/first/index/about.html index 4f77535e..7dc1b96f 100644 --- a/application/wap/view/first/index/about.html +++ b/application/wap/view/first/index/about.html @@ -3,8 +3,8 @@ {block name="content"}
-
-

+
+

众邦科技提供技术支持

diff --git a/application/wap/view/first/index/index.html b/application/wap/view/first/index/index.html index 732e6111..8ee9a1d7 100644 --- a/application/wap/view/first/index/index.html +++ b/application/wap/view/first/index/index.html @@ -9,7 +9,7 @@ {/block} {block name="title"} - + {/block} {block name="content"}
@@ -84,6 +84,58 @@ 查看更多 >
+ + + + + + + + {notempty name="storeSeckill"}
@@ -157,7 +209,8 @@ class="count">已售{{pro.sales}}{{pro.unit_name || '件'}}

-
+
+
新品推荐
@@ -247,6 +300,10 @@ data: { couponList: [], cateGroupList: [], + is_bestList: [],//精品推荐 + is_newList:[],//首发新品 + is_hotList: [],//热卖单品 + is_benefitList:[],//促销 page: {first: 0, limit: 20, list: [], loaded: false}, loading: false, scroll: null, @@ -377,13 +434,33 @@ that.loading = false }); }, + getproductList: function (type) { + var that = this; + storeApi.getPublicProductList({first:0, limit: 4,type:type}, function (res) { + if(type=='is_best') + that.is_bestList = res.data.data; + if(type=='is_hot') + that.is_hotList = res.data.data; + if(type=='is_new') + that.is_newList = res.data.data; + if(type=='is_benefit') + that.is_benefitList = res.data.data; + }, function () { + + }); + }, }, mounted: function () { var that = this; this.elInit(); this.getIssueCouponList(); +// this.getproductList('is_best');//精品 +// this.getproductList('is_hot');//热卖 +// this.getproductList('is_benefit');//促销 +// this.getproductList('is_new');//首发新品 + this.getIssueCouponList(); this.getCateData(); - this.getCombinationList(); + this.getCombinationList();//猜猜喜欢 setTimeout(function() { that.getList(); },0); diff --git a/application/wap/view/first/index/spread.html b/application/wap/view/first/index/spread.html index 8def42cf..e2ec75bb 100644 --- a/application/wap/view/first/index/spread.html +++ b/application/wap/view/first/index/spread.html @@ -11,7 +11,7 @@
- 搜索微信公众号
+ 搜索微信公众号
或长按上方二维码立即关注
@@ -22,9 +22,9 @@