Commit 300169ba by guoxy

init

parents
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data
def get_member():
method = "/member/findMemberWithPointDetail"
data = {}
# 舞象系统会员数据唯一主键
# data["memberId"] = "700000000013562"
# 手机号
# data["mobile"] = "13631277701"
# 微信 open_id
data["openId"] = "oUOIF0b3yZFBuOnXmrAa7FYlbb2g"
# data["openId"] = "o66IF0d0l1u4TQ73mPGDmvAPlILY"
# 线上卡号
# data["cardNoOnline"] = "100101008611111111111"
# 线下卡号
# data["cardNoOffline"] = "100101008611111111111"
post_data(method, data)
if __name__ == '__main__':
get_member()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data, get_time_str
def change_point():
method = "/member/memberPoint/updatePoint"
data = {}
# 会员信息
memberInfo = {}
# 舞象系统会员数据唯一主键
# memberInfo["memberId"] = "700000000013547"
# 手机号
memberInfo["mobile"] = "13631277701"
# 微信 open_id
# memberInfo["openId"] = "oUOIF0b3yZFBuOnXmrAa7FYlbb2g"
# 线上卡号
# memberInfo["cardNoOnline"] = ""
# 线下卡号
# memberInfo["cardNoOffline"] = ""
# 拓展信息
expandInfo = {}
# 积分变更类型为消费抵扣时,传递订单编号
expandInfo["offlineOrderNo"] = "20119052416113668288"
# 会员信息
data["memberInfo"] = memberInfo
# 积分变更值
data["changeValue"] = 100
# 积分变更类型1:会员注册 2:签到 3:消费有礼赠送 4:消费抵扣 5:消费有礼扣除 6:消费抵扣返还 7:积分兑换优惠券
data["changeType"] = "1"
# 积分变更渠道 pos / crm / oms / tmall
data["changeChannel"] = "pos"
# 积分变更门店CODE
data["changeStoreCode"] = "1002"
# 积分变更时间
data["changeTime"] = get_time_str(1)
# 积分变更流水编号
data["serialId"] = get_time_str(2)
# 拓展信息
data["expandInfo"] = expandInfo
# 备注
data["desc"] = "测试积分变更"
# data = "".join(json.dumps(data, ensure_ascii=False).split()).replace("&"," ")
# data = json.loads(data)
post_data(method, data)
if __name__ == '__main__':
change_point()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data
def get_point_setting():
method = "/member/pointExchangeMoney/getFromCache"
data = {}
# 品牌Id
# data["brandId"] = "1002"
post_data(method, data, "GET")
if __name__ == '__main__':
get_point_setting()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
import json
from utils import post_data
def get_coupon():
# 优惠券券码卡号
card_no = "98745070373655831174"
method = f"/coupon/coupon/get?cardNo={card_no}"
data = {}
# 优惠券券码卡号
data["card_no"] = card_no
post_data(method, data)
if __name__ == '__main__':
get_coupon()
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data
def check_coupon():
method = "/coupon/coupon/checkAndInvalid"
# method = "/coupon/coupon"
data = {}
# 自定义信息
expandInfo = {}
# 优惠券核销渠道为线下时 传递用于区分线下多个渠道
expandInfo["closeChannelCustom"] = "张江店1"
# 核销优惠券订单号
expandInfo["orderNo"] = "165416513131"
# 优惠券券码卡号
data["cardNo"] = "95895043128427811605"
# 核销渠道 ONLINE:线上 OFFLINE:线下
data["closeChannel"] = "OFFLINE"
# 品牌商标识
data["brandId"] = "1002"
# 自定义信息
data["expandInfo"] = expandInfo
# 使用优惠券门店
# data["useStoreId"] = "1002"
data["useStoreId"] = "12121220"
post_data(method, data)
if __name__ == '__main__':
check_coupon()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data, get_time_str
def upload_order():
method = "/sale/order/offLine/upload"
data = {}
# 会员信息
memberInfo = {}
# 舞象系统会员数据唯一主键
memberInfo["memberId"] = "700000000013562"
# 手机号
# memberInfo["mobile"] = "15618778396"
# 微信 open_id
# memberInfo["openId"] = "oUOIF0clIJgU9qT44wvjGEjJgRjI"
# 线上卡号
# memberInfo["cardNoOnline"] = ""
# 线下卡号
# memberInfo["cardNoOffline"] = ""
# 支付信息
payInfo = {}
# 支付类型 alipay:支付宝 weixin:微信 cash:现金 store_card:储值卡
payInfo["payType"] = "alipay"
# 支付金额 单位:分
payInfo["payMoney"] = 200
# 交易流水号
payInfo["serialId"] = get_time_str(3)
# 积分支付信息
pointPayInfo = {}
# 实际支付积分值
pointPayInfo["payPoint"] = 1000
# 积分对等的金额 单位:分
pointPayInfo["payMoney"] = 200
# 商品信息
productInfo = {}
# 商品序号, 订单内存在同一个sku商品时 使用,用于区分商品
# productInfo["index"] = ""
# 商品 CODE
productInfo["productCode"] = "101659"
# 商品 SKU CODE
productInfo["skuCode"] = "101659"
# 购买商品数量
productInfo["productCount"] = "1"
# 商品单价 单位:分
productInfo["productMoney"] = "10000"
# 当前商品优惠总金额 默认为0
productInfo["couponMoney"] = "0"
# 积分对等的金额 单位:分
#productInfo["couponInfo"] = couponInfo
# 优惠信息
couponInfo = {}
# 使用的优惠券 CODE
couponInfo["couponCode"] = "13131241"
# 优惠券针对整单商品的优惠金额
couponInfo["couponMoney"] = "100"
# 优惠券名称
couponInfo["couponName"] = "10元抵扣券"
# 参与营销活动信息,非必填,默认字段 gift_point 是否赠送积分默认为true
otherInfo = {}
# 是否消费送积分true
otherInfo["giftPoint"] = "true"
# 是否消费送经验值true
otherInfo["giftExp"] = "true"
# 订单优惠计算类型true(true:商品优惠金额汇总计算 false:订单总优惠金额)
otherInfo["calcCouponType"] = "true"
# 是否消费送积分false
otherInfo["destroyCoupon"] = "true"
# 是否校验并扣减 抵扣积分false
otherInfo["deductionPoint"] = "true"
# 会员信息
data["memberInfo"] = memberInfo
# 订单来源渠道
data["orderChannel"] = "线下pos"
# 商品总金额 单位:分
data["totalProductMoney"] = "10000"
# 优惠总金额 单位:分
# data["couponMoney"] = "0"
# 应支付金额 (商品总金额-优惠总金额) 单位:分
data["needPayMoney"] = "10000"
# 实际支付金额 单位:分
data["realPayMoney"] = "10000"
# 支付信息
data["payInfo"] = [payInfo]
# 积分支付信息
# data["pointPayInfo"] = pointPayInfo
# 订单创建时间yyyy-MM-dd HH:mm:ss
data["createTime"] = get_time_str(1)
data["payTime"] = get_time_str(1)
# 下单门店 CODE
data["storeCode"] = "1002"
# 线下订单编号
data["orderNo"] = get_time_str(3)
# 机器号
data["machineNo"] = "M10001"
# 商品信息
data["productInfo"] = [productInfo]
# 优惠信息
# data["couponInfo"] = [couponInfo]
# 参与营销活动信息,非必填,默认字段 gift_point 是否赠送积分默认为true
# data["otherInfo"] = otherInfo
# print(data)
# data = "".join(json.dumps(data, ensure_ascii=False).split()).replace("&"," ")
# data = json.loads(data)
post_data(method, data)
if __name__ == '__main__':
upload_order()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data, get_time_str
def upload_order_async():
method = "/sale/order/offLine/uplodaAsync"
data = {}
# 会员信息
memberInfo = {}
# 舞象系统会员数据唯一主键
memberInfo["memberId"] = "700000000013568"
# 手机号
# memberInfo["mobile"] = "15618778396"
# memberInfo["mobile"] = "15618778396"
# 微信 open_id
# memberInfo["openId"] = "oUOIF0clIJgU9qT44wvjGEjJgRjI"
# 线上卡号
# memberInfo["cardNoOnline"] = ""
# 线下卡号
# memberInfo["cardNoOffline"] = ""
# 支付信息
payInfo = {}
# 支付类型 alipay:支付宝 weixin:微信 cash:现金 store_card:储值卡
payInfo["payType"] = "alipay"
# 支付金额 单位:分
payInfo["payMoney"] = 200
# 交易流水号
payInfo["serialId"] = get_time_str(3)
# 积分支付信息
pointPayInfo = {}
# 实际支付积分值
pointPayInfo["payPoint"] = 1000
# 积分对等的金额 单位:分
pointPayInfo["payMoney"] = 200
# 商品信息
productInfo = {}
# 商品序号, 订单内存在同一个sku商品时 使用,用于区分商品
# productInfo["index"] = ""
# 商品 CODE
productInfo["productCode"] = "101659"
# 商品 SKU CODE
productInfo["skuCode"] = "101659,"
# 购买商品数量
productInfo["productCount"] = "1"
# 商品单价 单位:分
productInfo["productMoney"] = "10000"
# 当前商品优惠总金额 默认为0
# productInfo["couponMoney"] = "0"
# 积分对等的金额 单位:分
# productInfo["couponInfo"] = couponInfo
# 优惠信息
couponInfo = {}
# 使用的优惠券 CODE
couponInfo["couponCode"] = "13131241"
# 优惠券针对整单商品的优惠金额
couponInfo["couponMoney"] = "100"
# 优惠券名称
couponInfo["couponName"] = "10元抵扣券"
# 参与营销活动信息,非必填,默认字段 gift_point 是否赠送积分默认为true
otherInfo = {}
# 是否消费送积分true
otherInfo["giftPoint"] = "true"
# 是否消费送经验值true
otherInfo["giftExp"] = "true"
# 订单优惠计算类型true(true:商品优惠金额汇总计算 false:订单总优惠金额)
otherInfo["calcCouponType"] = "true"
# 是否消费送积分false
otherInfo["destroyCoupon"] = "true"
# 是否校验并扣减 抵扣积分false
otherInfo["deductionPoint"] = "true"
# 会员信息
data["memberInfo"] = memberInfo
# 订单来源渠道
data["orderChannel"] = "线下pos"
# 商品总金额 单位:分
data["totalProductMoney"] = "10000"
# 优惠总金额 单位:分
data["couponMoney"] = "100"
# 应支付金额 (商品总金额-优惠总金额) 单位:分
data["needPayMoney"] = "10000"
# 实际支付金额 单位:分
data["realPayMoney"] = "10000"
# 支付信息
data["payInfo"] = [payInfo]
# 积分支付信息
data["pointPayInfo"] = pointPayInfo
# 订单创建时间yyyy-MM-dd HH:mm:ss
data["createTime"] = get_time_str(1)
# 下单门店 CODE
data["storeCode"] = "1002"
# 线下订单编号
# data["orderNo"] = get_time_str(3)
data["orderNo"] = "30119052715561572125795"
# 机器号
# data["machineNo"] = "10001"
# 商品信息
# data["productInfo"] = [productInfo]
# 优惠信息
# data["couponInfo"] = [couponInfo]
# 参与营销活动信息,非必填,默认字段 gift_point 是否赠送积分默认为true
# data["otherInfo"] = otherInfo
# print(data)
# data = "".join(json.dumps(data, ensure_ascii=False).split()).replace("&"," ")
# data = json.loads(data)
post_data(method, data)
if __name__ == '__main__':
upload_order_async()
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data, get_time_str
def upload_return_order():
method = "/sale/orderReturn/offLine/upload"
data = {}
# 商品信息
productInfo = {}
# 商品 CODE
productInfo["productCode"] = "111"
# 商品 SKU CODE
productInfo["skuCode"] = "222"
# 退款商品数量
productInfo["refundCount"] = "333"
# 退款金额 单位:分
productInfo["refundMoney"] = "444"
# 其他拓展业务
otherInfo = {}
# 是否退回消费赠送积分true
otherInfo["returnGiftPoint"] = "true"
# 返还 积分支付抵扣积分
otherInfo["returnPayPoint"] = "true"
# 计算退款金额差异,调整积分
otherInfo["returnDifferencePoint"] = "false"
# 是否返还优惠券false
otherInfo["returnCoupon"] = "false"
# 原线下订单编号
data["orderNo"] = "111111111"
# 线下退单编号
data["refundNo"] = get_time_str(4)
# 下单门店 CODE
data["storeCode"] = "2132"
# 退款金额
data["refundMoney"] = "100000"
# 退单创建时间 yyyy-MM-dd HH:mm:ss
data["createTime"] = get_time_str()
# 商品信息
data["productInfo"] = productInfo
# 其他拓展业务
data["otherInfo"] = otherInfo
# print(data)
# data = "".join(json.dumps(data, ensure_ascii=False).split()).replace("&"," ")
# data = json.loads(data)
post_data(method, data)
if __name__ == '__main__':
upload_return_order()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data, get_time_str
def upload_return_order_async():
method = "/sale/order/offLine/uplodaAsync"
data = {}
# 商品信息
productInfo = {}
# 商品 CODE
productInfo["productCode"] = "111"
# 商品 SKU CODE
productInfo["skuCode"] = "222"
# 退款商品数量
productInfo["refundCount"] = "333"
# 退款金额 单位:分
productInfo["refundMoney"] = "444"
# 其他拓展业务
otherInfo = {}
# 是否退回消费赠送积分true
otherInfo["returnGiftPoint"] = "true"
# 返还 积分支付抵扣积分
otherInfo["returnPayPoint"] = "true"
# 计算退款金额差异,调整积分
otherInfo["returnDifferencePoint"] = "false"
# 是否返还优惠券false
otherInfo["returnCoupon"] = "false"
# 原线下订单编号
data["orderNo"] = "111111111"
# 线下退单编号
data["refundNo"] = get_time_str(4)
# 下单门店 CODE
data["storeCode"] = "2132"
# 退款金额
data["refundMoney"] = "100000"
# 退单创建时间 yyyy-MM-dd HH:mm:ss
data["createTime"] = get_time_str()
# 商品信息
data["productInfo"] = productInfo
# 其他拓展业务
data["otherInfo"] = otherInfo
# print(data)
# data = "".join(json.dumps(data, ensure_ascii=False).split()).replace("&"," ")
# data = json.loads(data)
post_data(method, data)
if __name__ == '__main__':
upload_return_order_async()
\ No newline at end of file
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 15:29
# @Author : MasterGuo
# @Email : guowj@bigaka.com
from utils import post_data, get_time_str
def check_goods_return_status():
method = "/sale/orderReturn/offLine/check"
data = {}
# 商品信息
productInfo = {}
# 商品 CODE
productInfo["productCode"] = "111"
# 商品 SKU CODE
productInfo["skuCode"] = "222"
# 退款商品数量
productInfo["refundCount"] = "333"
# 线下订单编号
data["orderNo"] = "1111"
# 商品信息
data["productInfo"] = productInfo
post_data(method, data)
if __name__ == '__main__':
check_goods_return_status()
\ No newline at end of file
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 14:05
# @Author : MasterGuo
# @Email : guowj@bigaka.com
# 启用某环境参数
env = "test"
config = {
"test": {
"url": "https://crm-b.bigaka.net/api",
"tunnel-token": "aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588fe"
},
"dev": {
"url": "http://seller.devapi.bigaka.net",
"tunnel-token": "aa8a1bfb7f6c5031d172d94b6574293ef954a6f2d4e16657da008e0cc15588fe"
},
"prod": {
"url": "",
"tunnel-token": ""
}
}
\ No newline at end of file
# -*- coding: utf-8 -*-
# @Time : 2019/5/24 23:45
# @Author : MasterGuo
# @Email : guowj@bigaka.com
import time
import requests
import json
import time
import uuid
import random
from config import config, env
def get_base_url():
if env in config.keys():
url = config.get(env).get("url")
token = config.get(env).get("tunnel-token")
headers = {
"Content-Type": "application/json",
"tunnel-token": token
# "tunnel-token": ""
}
if url and headers:
return url, headers
else:
return None
else:
return None
def post_data(method, data, md="POST", **headers):
if get_base_url():
url, headers = get_base_url()
url += method
print(url, headers)
input_json_data = json.dumps(data, ensure_ascii=False, indent=2)
print("="*60)
print((input_json_data))
print("="*60)
if md == "POST":
response = requests.post(url, json=data, headers=headers)
elif md == "GET":
response = requests.get(url, json=data, headers=headers)
if response.status_code == 200:
# 直接输出
# print (response.text.encode("utf-8").decode("utf-8"))
# 美化输出
response = json.loads(response.text.encode("utf-8").decode("utf-8"))
json_data = json.dumps(response, ensure_ascii=False, indent=2)
print(json_data)
else:
print("Error: " + response.text)
else:
print("Error: config")
def generateRandomstr(length=8):
randomData = str(int(uuid.uuid4()))
s = int(random.uniform(1, 9))
return randomData[s:s + length]
def get_time_str(type=0):
timestruct = time.localtime(time.time())
if type == 0:
# 格式如:2019-05-24&16:00:43
return time.strftime("%Y-%m-%d&%H:%M:%S", timestruct)
elif type == 1:
# 格式如:2019-05-24 16:00:43
return time.strftime("%Y-%m-%d %H:%M:%S", timestruct)
elif type == 2:
# 积分变更流水编号 201 19052416070146480
return time.strftime("201%y%m%d%H%M%S", timestruct) + generateRandomstr()
elif type == 3:
# 线下订单编号 301 19052416070146480
return time.strftime("301%y%m%d%H%M%S", timestruct) + generateRandomstr()
elif type == 4:
# 线下退单编号 302 19052416070146480
return time.strftime("302%y%m%d%H%M%S", timestruct) + generateRandomstr()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment