zoukankan      html  css  js  c++  java
  • php 实现店铺装修4

        /**
         * @title 发布装修的店铺
         * @example FlagShipShopDecorate.fabu? 调试参数:{"username":"17721355485","check_code":"123456","method":"FlagShipShopDecorate.fabu"}
         * @return {"status":"0","errorCode":"0","msg":"该样式已发布成功","result":[]}
         * @method POST
         * @author 邹柯
         */
        public function fabu($res){
            $user_id=session("user.user_id");
            $user_shop_decorate=M('user_shop_decorate');
            $usd_where['create_id']=$user_id;
            $usd_where['flagship_shop']=1;
            $res_info=$user_shop_decorate->field('id,use_status,plate_content_draft,plate_content_draft_features')->where($usd_where)->order('create_time desc')->find();
            if(!empty($res_info)){
                $us_where['id']=array("neq",$res_info['id']);
                $u_data=[
                    'use_status'=>1,
                    'select_status'=>1
                ];
                $res_da=$user_shop_decorate->data($u_data)->where($us_where)->save();
                if(!$res_da && $res_da !=0){
                    E('700403');
                }
            }
            $plate_content_draft=json_decode($res_info['plate_content_draft'],true);
            foreach($plate_content_draft as $k=>$v){
                foreach($v['goods'] as $k2=>$v2){
                    if($v2['operate_type']==2){
                        E('700415');
                    }
                }
            }
    
            $plate_content_draft_features=json_decode($res_info['plate_content_draft_features'],true);
            foreach($plate_content_draft_features as $k=>$v){
                $operate_types=array_unique(array_column($v['goods'],'operate_type'));
                if(count($operate_types) >=2){
                    E('700415');
                }
                if($operate_types[0]==2){
                    unset($plate_content_draft_features[$k]);
                }
            }
            $time=date("Y-m-d H:i:s",time());
            $data=array(
                'plate_content'=>$res_info['plate_content_draft'],
                'plate_content_features'=>empty($plate_content_draft_features)?null:json_encode($plate_content_draft_features),
                'status'=>2,
                'update_time'=>$time,
                'update_id'=>$user_id,
                'use_status'=>2,
                'select_status'=>2
            );
            $res=$user_shop_decorate->data($data)->where(['id'=>$res_info['id']])->save();
            if(!$res && $res !=0){
                E('700403');
            }
            $list['msg']="该样式已发布成功";
            return $list;
        }
  • 相关阅读:
    SICP习题 1.11 (一个函数的递归与迭代)
    SICP 实例 ExchangeMoney
    SICP 1.2.2 树形递归 与 线性迭代(斐波那契数)
    SICP习题 1.10(Ackermann函数)
    SICP习题 1.9 (递归与迭代初探)
    SICP实例 1.2.1 (阶乘的递归与迭代)
    SICP习题 1.8 (立方根)
    SICP习题 1.7 (求平方根改进)
    SICP习题 1.6 (再探 函数 与 正则序 应用序 关系)
    SICP实例 1.1.7 (求平方根)
  • 原文地址:https://www.cnblogs.com/zouke1220/p/9298962.html
Copyright © 2011-2022 走看看