Example #1
0
 def product_audit_dailysale(start_at=Common.current_time()[:10]):
     op_token = cf.operation_token1
     su_token = cf.supplier_token
     # 供应商添加商品
     obj = Business().post_GetVerifyCode(token=su_token, phone=19986415739)
     code = obj.json()['data']['content']
     time.sleep(3)
     obj = Business().post_ProductAfterSale(token=su_token,
                                            code=code,
                                            mobile=19986415739)
     product_after_sale_id = obj.json()['data']['id']
     p = Business.post_products(su_token,
                                freight_template=[1, 2],
                                product_after_sale_id=product_after_sale_id)
     product_id = Common.loads_text(p)["data"][0]["attributes"]["id"]
     # 运维审核通过
     Business.CompleteAudit(product_id)
     # 运维获取悟空团列表
     w = Business.get_daily_sales(op_token)
     # print(int(Common.loads_text(w)["data"]["today"])+type(Common.loads_text(w)["data"]["today"]))
     if Common.loads_text(w)["data"]["today"] == []:
         # 运维添加拼团
         Business.post_daily_sale_create(op_token,
                                         product_id=product_id,
                                         start_at=start_at)
     else:
         daily_sale_id = Common.loads_text(w)["data"]["today"]["id"]
         # 运维修改拼团
         product_list = Common.loads_text(w)["data"]["today"]["products"]
         Business.modify_dailysale(op_token, daily_sale_id, product_list,
                                   product_id)
     # 运维获取悟空团列表
     w = Business.get_daily_sales(op_token)
     product_id = Common.loads_text(w)["data"]["today"]["products"][0]['id']
     return product_id
Example #2
0
 def CompleteAudit(product_id=''):
     if product_id == '':
         su_token = cf.supplier_token
         # 供应商添加商品
         obj = Business().post_GetVerifyCode(token=su_token,
                                             phone=18928803919)
         code = obj.json()['data']['content']
         time.sleep(3)
         obj = Business().post_ProductAfterSale(token=su_token,
                                                code=code,
                                                mobile=18928803919)
         product_after_sale_id = obj.json()['data']['id']
         p = Business.post_products(
             su_token,
             freight_template=[1],
             product_after_sale_id=product_after_sale_id)
         product_id = Common.loads_text(p)["data"][0]["attributes"]["id"]
     token2 = cf.operation_token1
     obj = Business.get_product_info(token=token2, product_id=product_id)
     sku_id = obj.json()['data']['sku'][0]['id']
     Business.post_ProductInfoAudit(token=token2,
                                    product_id=product_id,
                                    approval_status=1,
                                    approval_reason='',
                                    name="专用枕头",
                                    short_title='专用枕头',
                                    contrast_url='',
                                    daily_category_id=7,
                                    department_id=12)
     Business.post_ProductSpecAudit(token=token2, product_id=product_id)
     Business.post_ProductFreightAudit(token=token2, product_id=product_id)
     Business.post_ProductLicenseAudit(token=token2, product_id=product_id)
     Business.post_CompleteAudit(token=token2, product_id=product_id)
     time.sleep(1)
     Business.post_ProductPricing(token=token2,
                                  product_id=product_id,
                                  sku_id=sku_id)
     return product_id