Пример #1
0
 def add_addsecond(self, afid):
     asidlist = []
     asnamelist = []
     addsecond = [
         ["滨盛创业园", "潮锦创业园", "江拓创业园"],
         ["创巢创业园", "下沙网", "浙江省海外留学人员创业园"],
         ["科技创业中心"],
         ["创意园区", "嘉得威创业园", "网络文学创业园"],
         ["江虹国际创业园", "万恒创业园", "京安创业园"],
         ["打铁关", "西兴", "龙翔桥", "江陵路"],
         ["白洋", "三墩", "文新", "沈塘桥"],
         ["新风", "市民中心", "南星桥", "复兴路"],
     ]
     for index, data in enumerate(afid):
         for asname in addsecond[index]:
             asid = str(uuid.uuid4())
             add_model("AddressSecond",
                       **{
                           "ASid": asid,
                           "AFid": data,
                           "ASname": asname
                       })
             asidlist.append(asid)
             asnamelist.append(asname)
     return asidlist, asnamelist
Пример #2
0
 def add_product(self, pid):
     try:
         add_model("Products",
                   **{
                       "PRid": pid[0],
                       "PRname": "测试套餐1",
                       "PRprice": 28.88,
                       "PRstatus": 1,
                       "PRimage": "http://120.79.182.43:7444/imgs/hello.jpg",
                       "PRinfo": "测试数据",
                       "PRsalesvolume": 100,
                       "PRscore": 4.2
                   })
         add_model("Products",
                   **{
                       "PRid": pid[1],
                       "PRname": "测试套餐2",
                       "PRprice": 18.88,
                       "PRstatus": 1,
                       "PRimage": "http://120.79.182.43:7444/imgs/hello.jpg",
                       "PRinfo": "测试数据",
                       "PRsalesvolume": 300,
                       "PRscore": 3.2
                   })
         add_model("Products",
                   **{
                       "PRid": pid[2],
                       "PRname": "测试套餐3",
                       "PRprice": 9.88,
                       "PRstatus": 1,
                       "PRimage": "http://120.79.182.43:7444/imgs/hello.jpg",
                       "PRinfo": "测试数据",
                       "PRsalesvolume": 120,
                       "PRscore": 3.5
                   })
         add_model("Products",
                   **{
                       "PRid": pid[3],
                       "PRname": "测试套餐4",
                       "PRprice": 15.88,
                       "PRstatus": 1,
                       "PRimage": "http://120.79.182.43:7444/imgs/hello.jpg",
                       "PRinfo": "测试数据",
                       "PRsalesvolume": 1001,
                       "PRscore": 2.1
                   })
         add_model("Products",
                   **{
                       "PRid": pid[4],
                       "PRname": "测试套餐5",
                       "PRprice": 13.88,
                       "PRstatus": 1,
                       "PRimage": "http://120.79.182.43:7444/imgs/hello.jpg",
                       "PRinfo": "测试数据",
                       "PRsalesvolume": 5,
                       "PRscore": 1.6
                   })
     except Exception as e:
         print e.message
Пример #3
0
 def add_machinery(self, pridlist, aaidlist):
     for aaid in aaidlist:
         for prid in pridlist:
             add_model("Machinery", **{
                 "MAid": str(uuid.uuid1()),
                 "AAid": aaid,
                 "PRid": prid
             })
Пример #4
0
 def add_addabo(self, asidlist, asnamelist):
     aaid_list = []
     for index, i in enumerate(asidlist):
         aaid = str(uuid.uuid4())
         add_model("AddressAbo",
                   **{
                       "AAid": aaid,
                       "ASid": i,
                       "AAmessage": asnamelist[index] + "A区拐角机器",
                       "AAimage": "图片地址",
                   })
         aaid_list.append(aaid)
     return aaid_list
Пример #5
0
 def add_coupons(self, coid):
     try:
         for row in coid:
             add_model("Coupons",
                       **{
                           "COid": row,
                           "COfilter": 20,
                           "COdiscount": 1,
                           "COamount": None,
                           "COstart": None,
                           "COend": None
                       })
     except Exception as e:
         print e.message
Пример #6
0
 def add_user(self, uid):
     try:
         add_model("Users",
                   **{
                       "USid": uid,
                       "UStelphone": "17706441101",
                       "USpassword": "******",
                       "USname": "测试账号",
                       "USsex": 101,
                       "UScoin": 100.1,
                       "USinvatecode": "ETECH007"
                   })
     except Exception as e:
         print e.message
Пример #7
0
    def add_or_update_cart(self):
        args = request.args.to_dict()
        data = json.loads(request.data)

        if "token" not in args:
            return self.param_miss
        uid = args.get("token")
        pid = data.get("Pid")
        pnum = data.get("Pnum")
        if pnum <= 0:
            # from config.messages import error_messages_pnum_illegal as msg
            # from config.status import response_error as status
            # from config.status_code import error_pnum_illegal as code
            # return {"status": status, "statuscode": code, "message": msg}
            # elif pnum == 0:
            return self.del_cart()

        try:
            if not self.spro.get_product_all_by_pid(pid):
                from config.messages import error_messages_no_pid as msg
                from config.status import response_error as status
                from config.status_code import error_no_pid as code
                return {"status": status, "statuscode": code, "message": msg}
            cart = self.scart.get_cart_by_uid_pid(uid, pid)
            if cart:
                self.scart.update_num_cart(pnum, cart.Caid)
            else:
                add_model(
                    "Cart", **{
                        "Caid": str(uuid.uuid4()),
                        "Pnum": pnum,
                        "Uid": uid,
                        "Castatus": 1,
                        "Pid": pid
                    })
        except dberror:
            return self.system_error
        except Exception as e:
            print(e.message)
            return self.system_error

        from config.messages import messages_add_cart as msg
        return {"status": ok, "message": msg}
Пример #8
0
 def add_cardpackage(self, coid, uid):
     try:
         add_model("Cardpackage",
                   **{
                       "CAid": str(uuid.uuid4()),
                       "USid": uid,
                       "COid": coid[0],
                       "CAstatus": 1,
                       "CAstart": "20180423000000",
                       "CAend": "20180429000000"
                   })
         add_model("Cardpackage",
                   **{
                       "CAid": str(uuid.uuid4()),
                       "USid": uid,
                       "COid": coid[1],
                       "CAstatus": 2,
                       "CAstart": "20180429000000",
                       "CAend": "20180522000000"
                   })
         add_model("Cardpackage",
                   **{
                       "CAid": str(uuid.uuid4()),
                       "USid": uid,
                       "COid": coid[2],
                       "CAstatus": 2,
                       "CAstart": "20180329000000",
                       "CAend": "20180419000000"
                   })
     except Exception as e:
         print e.message
Пример #9
0
 def add_addfirst(self, acid):
     afidlist = []
     addfirst = [
         {"name": "萧山区", "aftype": 1},
         {"name": "下沙区", "aftype": 1},
         {"name": "上城区", "aftype": 1},
         {"name": "下城区", "aftype": 1},
         {"name": "滨江区", "aftype": 1},
         {"name": "地铁1号线", "aftype": 0},
         {"name": "地铁2号线", "aftype": 0},
         {"name": "地铁4号线", "aftype": 0},
     ]
     for data in addfirst:
         afid = str(uuid.uuid4())
         add_model("AddressFirst",
                   **{
                       "AFid": afid,
                       "ACid": acid,
                       "AFtype": data["aftype"],
                       "AFname": data["name"],
                   })
         afidlist.append(afid)
     return afidlist
Пример #10
0
 def add_city(self, acid):
     add_model("AddCity",
               **{
                   "ACid": acid,
                   "ACname": "杭州市"
               })