@@ -5,33 +5,37 @@ import ( | |||
) | |||
type CommunityTeamOrder struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||
StoreType int `json:"store_type" xorm:"default 0 comment('0官方自营店 1加盟店 2连锁店') INT(11)"` | |||
StoreUid int `json:"store_uid" xorm:"default 0 comment('门店用户id') INT(11)"` | |||
ParentUid int `json:"parent_uid" xorm:"default 0 comment('上级代理') INT(11)"` | |||
Num int `json:"num" xorm:"default 0 comment('') INT(11)"` | |||
CouponId int `json:"coupon_id" xorm:"default 0 comment('') INT(11)"` | |||
Address string `json:"address" xorm:"comment('详细地址') VARCHAR(255)"` | |||
Commission string `json:"commission" xorm:"default 0.00 comment('分佣(元)') DECIMAL(20,2)"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` | |||
BuyPhone string `json:"buy_phone" xorm:"VARCHAR(255)"` | |||
Phone string `json:"phone" xorm:"VARCHAR(255)"` | |||
BuyName string `json:"buy_name" xorm:"VARCHAR(255)"` | |||
State int `json:"state" xorm:"default 0 comment('0待付款 1已支付 2已提货') INT(11)"` | |||
PayAt time.Time `json:"pay_at" xorm:"comment('付款时间') DATETIME"` | |||
ConfirmAt time.Time `json:"confirm_at" xorm:"comment('提货时间') DATETIME"` | |||
Oid int64 `json:"oid" xorm:"default 0 comment('主单号') BIGINT(20)"` | |||
Code string `json:"code" xorm:"comment('提货码') VARCHAR(255)"` | |||
Type int `json:"type" xorm:"default 0 comment('0自提 1外卖') INT(1)"` | |||
PayMethod int `json:"pay_method" xorm:"default 0 comment('1余额 2支付宝 3微信') INT(11)"` | |||
PayId string `json:"pay_id" xorm:"comment('第三方的支付id') VARCHAR(255)"` | |||
Amount string `json:"amount" xorm:"default 0.00 comment('总金额') DECIMAL(20,2)"` | |||
Memo string `json:"memo" xorm:"comment('备注') VARCHAR(255)"` | |||
TakeTime time.Time `json:"take_time" xorm:"comment('预计提货时间') DATETIME"` | |||
MealNum int `json:"meal_num" xorm:"default 0 comment('餐具数量') INT(11)"` | |||
Coupon string `json:"coupon" xorm:"default 0.00 DECIMAL(10,2)"` | |||
Timer string `json:"timer" xorm:"comment('预计提货时间') VARCHAR(255)"` | |||
IsNow int `json:"is_now" xorm:"default 0 comment('是否立即提货') INT(1)"` | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||
StoreType int `json:"store_type" xorm:"default 0 comment('0官方自营店 1加盟店 2连锁店') INT(11)"` | |||
StoreUid int `json:"store_uid" xorm:"default 0 comment('门店用户id') INT(11)"` | |||
ParentUid int `json:"parent_uid" xorm:"default 0 comment('上级代理') INT(11)"` | |||
Num int `json:"num" xorm:"default 0 comment('') INT(11)"` | |||
CouponId int `json:"coupon_id" xorm:"default 0 comment('') INT(11)"` | |||
Address string `json:"address" xorm:"comment('详细地址') VARCHAR(255)"` | |||
Commission string `json:"commission" xorm:"default 0.00 comment('分佣(元)') DECIMAL(20,2)"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` | |||
CancelAt time.Time `json:"cancel_at" xorm:"DATETIME"` | |||
BuyPhone string `json:"buy_phone" xorm:"VARCHAR(255)"` | |||
Phone string `json:"phone" xorm:"VARCHAR(255)"` | |||
BuyName string `json:"buy_name" xorm:"VARCHAR(255)"` | |||
State int `json:"state" xorm:"default 0 comment('0待付款 1已支付 2已提货') INT(11)"` | |||
PayAt time.Time `json:"pay_at" xorm:"comment('付款时间') DATETIME"` | |||
ConfirmAt time.Time `json:"confirm_at" xorm:"comment('提货时间') DATETIME"` | |||
Oid int64 `json:"oid" xorm:"default 0 comment('主单号') BIGINT(20)"` | |||
Code string `json:"code" xorm:"comment('提货码') VARCHAR(255)"` | |||
Type int `json:"type" xorm:"default 0 comment('0自提 1外卖') INT(1)"` | |||
PayMethod int `json:"pay_method" xorm:"default 0 comment('1余额 2支付宝 3微信') INT(11)"` | |||
PayId string `json:"pay_id" xorm:"comment('第三方的支付id') VARCHAR(255)"` | |||
Amount string `json:"amount" xorm:"default 0.00 comment('总金额') DECIMAL(20,2)"` | |||
Memo string `json:"memo" xorm:"comment('备注') VARCHAR(255)"` | |||
TakeTime time.Time `json:"take_time" xorm:"comment('预计提货时间') DATETIME"` | |||
MealNum int `json:"meal_num" xorm:"default 0 comment('餐具数量') INT(11)"` | |||
Coupon string `json:"coupon" xorm:"default 0.00 DECIMAL(10,2)"` | |||
Timer string `json:"timer" xorm:"comment('预计提货时间') VARCHAR(255)"` | |||
IsNow int `json:"is_now" xorm:"default 0 comment('是否立即提货') INT(1)"` | |||
StoreSettleAt int `json:"store_settle_at" xorm:"default 0 comment('') INT(11)"` | |||
SettleAt int `json:"settle_at" xorm:"default 0 comment('') INT(11)"` | |||
CommissionAt int `json:"commission_at" xorm:"default 0 comment('') INT(11)"` | |||
} |
@@ -2,281 +2,10 @@ package md | |||
// 获取用户的缓存key | |||
const ( | |||
KEY_SYS_CFG_CACHE = "sys_cfg_cache" | |||
FunctionPermissionCfgCacheKey = "%s:function_permission_cfg" | |||
// 文件缓存的key | |||
KEY_CFG_FILE_PVD = "file_provider" // 文件供应商 | |||
KEY_CFG_FILE_BUCKET = "file_bucket" | |||
KEY_CFG_FILE_REGION = "file_bucket_region" | |||
KEY_CFG_FILE_HOST = "file_bucket_host" | |||
KEY_CFG_FILE_SCHEME = "file_bucket_scheme" | |||
KEY_CFG_FILE_AK = "file_access_key" | |||
KEY_CFG_FILE_SK = "file_secret_key" | |||
KEY_CFG_FILE_MAX_SIZE = "file_user_upload_max_size" | |||
KEY_CFG_FILE_EXT = "file_ext" | |||
KEY_CFG_FILE_AVATAR_THUMBNAIL = "file_avatar_thumbnail" // 默认头像缩略图参数,宽高120px,格式webp. | |||
// 智盟 | |||
KEY_CFG_ZM_JD_SITE_ID = "third_zm_jd_site_id" // 智盟京东联盟id | |||
KEY_CFG_ZM_WEB_ID = "third_zm_web_id" // 智盟网站ID | |||
KEY_CFG_ZM_AK = "third_zm_app_key" | |||
KEY_CFG_ZM_SK = "third_zm_app_secret" | |||
KEY_CFG_ZM_SMS_AK = "third_zm_sms_ak" | |||
KEY_CFG_ZM_SMS_SK = "third_zm_sms_sk" | |||
KEY_CFG_APP_NAME = "app_name" | |||
KEY_SYS_CFG_CACHE = "sys_cfg_cache" | |||
KEY_CFG_WHITELIST = "api_cfg_whitelist" // API允许的访问的设置白名单 | |||
// 淘宝 | |||
KEY_CFG_TB_AUTH_AK = "third_taobao_auth_ak" | |||
KEY_CFG_TB_AUTH_SK = "third_taobao_auth_sk" | |||
KEY_CFG_TB_INVITER_CODE = "third_taobao_auth_inviter_code" | |||
KEY_CFG_TB_AK = "third_taobao_ak" | |||
KEY_CFG_TB_SK = "third_taobao_sk" | |||
KEY_CFG_TB_PID = "third_taobao_pid" // 淘宝推广ID,如:mm_123_456_789,123是联盟ID,456是site_id,789是adzone_id | |||
KEY_CFG_TB_SID = "third_taobao_sid" // 淘宝session id ,又称access_token | |||
// 苏宁 | |||
KEY_CFG_SN_AK = "third_suning_ak" | |||
KEY_CFG_SN_SK = "third_suning_sk" | |||
KEY_CFG_JD_AK = "" | |||
KEY_CFG_JD_SK = "" | |||
KEY_CFG_KL_AK = "third_kaola_ak" | |||
KEY_CFG_KL_SK = "third_kaola_sk" | |||
KEY_CFG_VIP_AK = "" | |||
KEY_CFG_VIP_SK = "" | |||
// 自动任务配置 | |||
KEY_CFG_CRON_TB = "cron_order_taobao" | |||
KEY_CFG_CRON_TBSETTLEORDER = "cron_order_taobao_settle_order" | |||
KEY_CFG_CRON_JD = "cron_order_jd" | |||
KEY_CFG_CRON_PDD = "cron_order_pdd" | |||
KEY_CFG_CRON_PDD_SUCC = "cron_order_pdd_succ" | |||
KEY_CFG_CRON_PDDBYCREATETIME = "cron_order_pdd_by_create_time" | |||
KEY_CFG_CRON_PDDBYLOOPTIME = "cron_order_pdd_by_loop_time" | |||
KEY_CFG_CRON_PDDBYLOOPMONTHTIME = "cron_order_pdd_by_loop_month_ago_time" | |||
KEY_CFG_CRON_JDBYCREATETIME = "cron_order_jd_by_create_time" | |||
KEY_CFG_CRON_JDBYSUCCESS = "cron_order_jd_by_success" | |||
KEY_CFG_CRON_JDFAILBYCREATETIME = "cron_order_jd_fail_by_create_time" | |||
KEY_CFG_CRON_PDDBYAGOTIME = "cron_order_pdd_by_ago_time" | |||
KEY_CFG_CRON_PDDBYSTATUS = "cron_order_pdd_by_status" | |||
KEY_CFG_CRON_PDDBYSTATUSSUCCESS = "cron_order_pdd_by_status_success" | |||
KEY_CFG_CRON_PDDBYSTATUSFAIL = "cron_order_pdd_by_status_fail" | |||
KEY_CFG_CRON_JDBYSTATUS = "cron_order_jd_by_status" | |||
KEY_CFG_CRON_TBBYAGOTIME = "cron_order_tb_by_ago_time" | |||
KEY_CFG_CRON_TBBYPAY = "cron_order_tb_by_pay" | |||
KEY_CFG_CRON_TB12 = "cron_order_tb12" | |||
KEY_CFG_CRON_TB13 = "cron_order_tb13" | |||
KEY_CFG_CRON_TB3 = "cron_order_tb3" | |||
KEY_CFG_CRON_TB14 = "cron_order_tb14" | |||
KEY_CFG_CRON_PDDREFUND = "cron_order_pdd_refund" | |||
KEY_CFG_CRON_TBREFUND = "cron_order_tb_refund" | |||
KEY_CFG_CRON_WPHREFUND = "cron_order_wph_refund" | |||
KEY_CFG_CRON_JDREFUND = "cron_order_jd_refund" | |||
KEY_CFG_CRON_SN = "cron_order_suning" | |||
KEY_CFG_CRON_VIP = "cron_order_vip" | |||
KEY_CFG_CRON_KL = "cron_order_kaola" | |||
KEY_CFG_CRON_DUOMAI = "cron_order_duomai" | |||
KEY_CFG_CRON_HIS = "cron_order_his" // 迁移到历史订单 | |||
KEY_CFG_CRON_SETTLE = "cron_order_settle" //结算 | |||
KEY_CFG_CRON_FREE_SETTLE = "cron_order_free_settle" //结算 | |||
KEY_CFG_CRON_SECOND_FREE_SETTLE = "cron_order_second_free_settle" | |||
KEY_CFG_CRON_THIRD_FREE_SETTLE = "cron_order_third_free_settle" | |||
KEY_CFG_CRON_ACQUISTION_SETTLE = "cron_acquistion_settle" // 拉新结算 | |||
KEY_CFG_CRON_NEW_ACQUISTION_SETTLE = "cron_new_acquistion_settle" // 拉新结算 | |||
KEY_CFG_CRON_PUBLISHER = "cron_taobao_publisher" // 跟踪淘宝备案信息绑定会员运营id 针对小程序 | |||
KEY_CFG_CRON_AUTO_UN_FREEZE = "cron_auto_un_freeze" | |||
KEY_CFG_CRON_MEITUAN = "cron_order_meituan_fxlm" //美团 | |||
KEY_CFG_CRON_MEITUANLM = "cron_order_meituan_lm" //美团联盟 | |||
KEY_CFG_CRON_MEITUANLM_START = "cron_order_meituan_lm_start" //美团联盟 | |||
KEY_CFG_CRON_ORDER_SUCCESS_CHECK = "cron_order_success_check" | |||
KEY_CFG_CRON_MEITUAN_START = "cron_order_meituan_start" //美团联盟 | |||
KEY_CFG_CRON_STARBUCKS = "cron_order_starbucks" //海威星巴克 | |||
KEY_CFG_CRON_HWMOVIE = "cron_order_hw_movie" //海威电影票 | |||
KEY_CFG_CRON_MCDONALD = "cron_order_mcdonald" //海威麦当劳 | |||
KEY_CFG_CRON_NAYUKI = "cron_order_nayuki" //海威奈雪 | |||
KEY_CFG_CRON_BURGERKING = "cron_order_burger_king" //海威汉堡王 | |||
KEY_CFG_CRON_HEYTEA = "cron_order_heytea" //海威喜茶 | |||
KEY_CFG_CRON_TIKTOKLIFE = "cron_order_tik_tok_life" // | |||
KEY_CFG_CRON_FAST_REFUND = "cron_order_fast_refund" | |||
KEY_CFG_CRON_CHECK_GUIDE_STORE_ORDER = "cron_check_guide_store_order" | |||
KEY_CFG_CRON_CHECK_BUCKLE_ORDER = "cron_check_buckle_order" | |||
KEY_CFG_CRON_BUCKLE = "cron_order_buckle" | |||
KEY_CFG_CRON_FAST_SUCCESS = "cron_order_fast_success" | |||
KEY_CFG_CRON_PIZZA = "cron_order_pizza" //海威 | |||
KEY_CFG_CRON_WALLACE = "cron_order_wallace" //海威 | |||
KEY_CFG_CRON_TOURISM = "cron_order_tourism" //海威 | |||
KEY_CFG_CRON_NEAR = "cron_order_near" //海威 | |||
KEY_CFG_CRON_FLOWERCAKE = "cron_order_flowerCake" //海威 | |||
KEY_CFG_CRON_DELIVERY = "cron_order_delivery" //海威 | |||
KEY_CFG_CRON_TO_KFC = "cron_order_to_kfc" // | |||
KEY_CFG_CRON_PAGODA = "cron_order_pagoda" // | |||
KEY_CFG_CRON_LUCKIN = "cron_order_luckin" // | |||
KEY_CFG_CRON_STATIONMEITUANLM = "cron_order_station_meituan_lm" //站长美团联盟 | |||
KEY_CFG_CRON_MEITUANOFFICIAL = "cron_order_meituan_official" //美团联盟智莺 | |||
KEY_CFG_CRON_OILSTATION = "cron_order_oilstation" //加油 | |||
KEY_CFG_CRON_BRIGHTOILSTATION = "cron_order_bright_oilstation" //加油 | |||
KEY_CFG_CRON_KFC = "cron_order_kfc" //肯德基 | |||
KEY_CFG_CRON_CINEMA = "cron_order_cinema" //电影票 | |||
KEY_CFG_CRON_OilRequest = "cron_order_oilrequest" //加入主动请求抓单 | |||
KEY_CFG_CRON_AGOTB = "cron_order_agotaobao" //n天前的淘宝订单 | |||
KEY_CFG_CRON_CREDIT_CARD = "cron_order_credit_card" | |||
KEY_CFG_CRON_ORDER_STAT = "cron_order_stat" // 订单统计任务 | |||
KEY_CFG_CRON_CARD_UPDATE = "cron_card_update" // 权益卡更新 | |||
KEY_CFG_CRON_USER_LV_UP_SETTLE = "cron_user_lv_up_settle" //会员费订单结算 | |||
KEY_CFG_CRON_DUOYOUORD_SETTLE = "cron_duoyou_settle" //会员费订单结算 | |||
KEY_CFG_CRON_LIANLIAN_SETTLE = "cron_lianlian_settle" //会员费订单结算 | |||
KEY_CFG_CRON_SWIPE_SETTLE = "cron_swipe_settle" | |||
KEY_CFG_CRON_AGGREGATION_RECHARGE_SETTLE = "cron_aggregation_recharge_settle" | |||
KEY_CFG_CRON_ACQUISITION_CONDITION = "cron_acquisition_condition" | |||
KEY_CFG_CRON_ACQUISITION_CONDITION_BY_LV = "cron_acquisition_condition_by_lv" | |||
KEY_CFG_CRON_ACQUISITION_REWARD = "cron_acquisition_reward" | |||
KEY_CFG_CRON_PLAYLET_SETTLE = "cron_playlet_settle" | |||
KEY_CFG_CRON_TIKTOK_AUTH = "cron_tik_tok_auth" | |||
KEY_CFG_CRON_TASKBOX_SETTLE = "cron_task_box_settle" //会员费订单结算 | |||
KEY_CFG_CRON_PRIVILEGE_CARD_SETTLE = "cron_privilege_card_settle" //权益卡订单结算 | |||
KEY_CFG_CRON_CARD_RETURN = "cron_card_return" //权益卡退款 | |||
KEY_CFG_CRON_PUBLISHER_RELATION = "cron_taobao_publisher_relation" //获取淘宝渠道 | |||
KEY_CFG_CRON_PUBLISHER_RELATION_NEW = "cron_taobao_publisher_relation_new" //获取淘宝渠道 | |||
KEY_CFG_CRON_DTKBRAND = "cron_dtk_brand" //大淘客品牌信息 | |||
KEY_CFG_CRON_PUBLISHER_RELATION_BIND = "cron_taobao_publisher_relation_bind" //获取淘宝渠道绑定 | |||
KEY_CFG_CRON_GOODS_SHELF = "cron_goods_shelf" //商品上下架定时任务 | |||
KEY_CFG_CRON_DIDI_ENERGY = "cron_order_didi_energy" // | |||
KEY_CFG_CRON_T3_CAR = "cron_order_t3_car" // | |||
KEY_CFG_CRON_DIDI_ONLINE_CAR = "cron_order_didi_online_car" // | |||
KEY_CFG_CRON_KING_FLOWER = "cron_order_king_flower" // | |||
KEY_CFG_CRON_DIDI_CHAUFFEUR = "cron_order_didi_chauffeur" // | |||
KEY_CFG_CRON_PLAYLET_ORDER = "cron_order_playlet_order" // | |||
KEY_CFG_CRON_PLAYLET_GOODS = "cron_order_playlet_goods" // | |||
KEY_CFG_CRON_CARD_CHECK_RETURN = "cron_card_check_return" // | |||
KEY_CFG_CRON_CARD_CHECK_UPDATE = "cron_card_check_update" // | |||
KEY_CFG_CRON_DIDI_FREIGHT = "cron_order_didi_freight" // | |||
KEY_CFG_CRON_TB_PUNISH_REFUND = "cron_order_tb_punish_refund" | |||
KEY_CFG_CRON_TIKTOK = "cron_order_tikTok" | |||
KEY_CFG_CRON_ELM = "cron_order_elm" | |||
KEY_CFG_CRON_AUTO_ADD_TIKTOK_GOODS = "cron_order_auto_add_tiktok_goods" | |||
KEY_CFG_CRON_TIKTOKOwn = "cron_order_tikTokOwn" | |||
KEY_CFG_CRON_TIKTOKCsjp = "cron_order_tikTokCsjp" | |||
KEY_CFG_CRON_TIKTOKCsjpLive = "cron_order_tikTokCsjpLive" | |||
KEY_CFG_CRON_TIKTOKOwnCsjp = "cron_order_tikTokOwnCsjp" | |||
KEY_CFG_CRON_TIKTOKOwnCsjpLive = "cron_order_tikTokOwnCsjpLive" | |||
KEY_CFG_CRON_TIKTOKOwnCsjpActivity = "cron_order_tikTokOwnCsjpActivity" | |||
KEY_CFG_CRON_PlayLet_Total = "cron_playlet_total" | |||
KEY_CFG_CRON_TIKTOKOwnCreate = "cron_order_tikTokOwnCreate" | |||
KEY_CFG_CRON_KuaishouOwn = "cron_order_kuaishouOwn" | |||
KEY_CFG_CRON_KuaishouOwnCreate = "cron_order_kuaishouOwnCreate" | |||
KEY_CFG_CRON_TIKTOKOwnACtivity = "cron_order_tikTokOwnActivity" | |||
KEY_CFG_CRON_DUOYOUORD = "cron_order_DouYouOrd" | |||
KEY_CFG_CRON_TASKBOX = "cron_order_TaskBox" | |||
KEY_CFG_CRON_TASKBOXSECOND = "cron_order_TaskBoxSecond" | |||
KEY_CFG_CRON_TIKTOKOwnMixH5 = "cron_order_tikTokOwnMixH5" | |||
KEY_CFG_CRON_TIKTOKLIVE_UPDATE = "cron_order_tikTokLive_update" | |||
KEY_CFG_CRON_KUAISHOU = "cron_order_kuaishou" | |||
KEY_CFG_CRON_KUAISHOUOFFICIAL = "cron_order_kuaishou_official" | |||
KEY_CFG_CRON_KUAISHOUOFFICIALLive = "cron_order_kuaishou_official_live" | |||
KEY_CFG_CRON_MEITUANFFICIAL = "cron_order_meituan_official" | |||
KEY_CFG_CRON_TIKTOKLIVE = "cron_order_tikTok_live" | |||
KEY_CFG_CRON_TIKTOKLIVEOWN = "cron_order_tikTok_live_own" | |||
KEY_CFG_CRON_TIKTOKACTIVITY = "cron_order_tikTok_activity" | |||
KEY_CFG_CRON_KUAISHOULIVE = "cron_order_kuaishou_live" | |||
ZhimengCronPlayletVideoOrder = "cron_playlet_video_order" //短剧订单 | |||
ZhimengCronPlayletAdvOrder = "cron_playlet_adv_order" //短剧广告订单 | |||
ZhimengCronPlayletVideoOrderYesterDay = "cron_playlet_video_order_yesterday" | |||
ZhimengCronPlayletVideoOrderMonth = "cron_playlet_video_order_month" | |||
ZhimengCronPlayletAdvOrderYesterDay = "cron_playlet_adv_order_yesterday" | |||
ZhimengCronPlayletAdvOrderMonth = "cron_playlet_adv_order_month" | |||
ZhimengCronPlayletAdvOrderYesterDayToMoney = "cron_playlet_adv_order_yesterday_to_money" | |||
KEY_CFG_TIK_TOK_TEAM_ORDER_PAY = "cron_tik_tok_team_order_pay" | |||
KEY_CFG_KUAISHOU_TEAM_ORDER_PAY = "cron_kuaishou_team_order_pay" | |||
KEY_CFG_KUAISHOU_TEAM_ORDER_UPDATE = "cron_kuaishou_team_order_update" | |||
KEY_CFG_KUAISHOU_AUTH = "cron_kuaishou_auth" | |||
KEY_CFG_VERIFY = "cron_verify" | |||
KEY_CFG_TIK_TOK_TEAM_ORDER_UPDATE = "cron_tik_tok_team_order_update" | |||
KEY_CFG_TIK_TOK_TEAM_USER_BIND_BUYINID = "cron_tik_tok_team_user_bind_buyinid" | |||
// 自动任务运行时设置 | |||
KEY_CFG_CRON_TIME_PIZZA = "crontab_order_time_pizza" | |||
KEY_CFG_CRON_TIME_WALLACE = "crontab_order_time_wallace" | |||
KEY_CFG_CRON_TIME_TOURISM = "crontab_order_time_tourism" | |||
KEY_CFG_CRON_TIME_NEAR = "crontab_order_time_pizza" | |||
KEY_CFG_CRON_TIME_FLOWERCAKE = "crontab_order_time_flowerCake" | |||
KEY_CFG_CRON_TIME_DELIVERY = "crontab_order_time_delivery" | |||
KEY_CFG_CRON_TIME_TIKTOK = "crontab_order_time_tikTok" | |||
KEY_CFG_CRON_TIME_ELM = "crontab_order_time_elm" | |||
KEY_CFG_CRON_TIME_TIKTOKOwn = "crontab_order_time_tikTokOwn" | |||
KEY_CFG_CRON_TIME_TIKTOKOwnCreate = "crontab_order_time_tikTokOwnCreate" | |||
KEY_CFG_CRON_TIME_KuaishouOwn = "crontab_order_time_kuaishouOwn" | |||
KEY_CFG_CRON_TIME_KuaishouOwnCreate = "crontab_order_time_kuaishouOwnCreate" | |||
KEY_CFG_CRON_TIME_TIKTOKOwnActivity = "KEY_CFG_CRON_TIME_TIKTOKOwnActivity" | |||
KEY_CFG_CRON_TIME_TIKTOKOwnMix = "KEY_CFG_CRON_TIME_TIKTOKOwnMix" | |||
KEY_CFG_CRON_TIME_TIKTOKOwnLive = "crontab_order_time_tikTokOwnLive" | |||
KEY_CFG_CRON_TIME_KUAISHOU = "crontab_order_time_kuaishou" | |||
KEY_CFG_CRON_TIME_TIKTOKLIVE = "crontab_order_time_tikTok_live" | |||
KEY_CFG_CRON_TIME_KUAISHOULIVE = "crontab_order_time_kuaishou_live" | |||
KEY_CFG_CRON_TIME_TB = "crontab_order_time_taobao" | |||
KEY_CFG_CRON_TIME_CSJP = "crontab_order_time_csjp" | |||
KEY_CFG_CRON_TIME_KUAISHOU_OFFICIAL = "crontab_order_time_kuaishou_official" | |||
KEY_CFG_CRON_TIME_KUAISHOU_OFFICIAL_LIVE = "crontab_order_time_kuaishou_official_live" | |||
KEY_CFG_CRON_TIME_MEITUAN_OFFICIAL = "crontab_order_time_meituan_official" | |||
KEY_CFG_CRON_TIME_CSJP_Live = "crontab_order_time_csjp_live" | |||
KEY_CFG_CRON_TIME_OWN_CSJP = "crontab_order_time_own_csjp" | |||
KEY_CFG_CRON_TIME_TIKTOK_TEAM_ORDER = "crontab_order_time_tiktok_team_order" | |||
KEY_CFG_CRON_TIME_OWN_CSJP_Live = "crontab_order_time_own_csjp_live" | |||
KEY_CFG_CRON_TIME_OWN_CSJP_ACTIVITY = "crontab_order_time_own_csjp_activity" | |||
KEY_CFG_CRON_TIME_TBREFUND = "crontab_order_time_taobao_refund" | |||
KEY_CFG_CRON_TIME_TBPUNISHREFUND = "crontab_order_time_taobao_punish_refund_new" | |||
KEY_CFG_CRON_TIME_JD = "crontab_order_time_jd" | |||
KEY_CFG_CRON_TIME_PDD = "crontab_order_time_pdd" | |||
KEY_CFG_CRON_TIME_TBBYCREATETIME = "crontab_order_time_tb_by_create_time" | |||
KEY_CFG_CRON_TIME_TBBYPAY = "crontab_order_time_tb_by_pay" | |||
KEY_CFG_CRON_TIME_TB12 = "crontab_order_time_tb12" | |||
KEY_CFG_CRON_TIME_TB13 = "crontab_order_time_tb13" | |||
KEY_CFG_CRON_TIME_TB14 = "crontab_order_time_tb14" | |||
KEY_CFG_CRON_TIME_TB3 = "crontab_order_time_tb3" | |||
KEY_CFG_CRON_TIME_TBBYSETTLE = "crontab_order_time_tb_by_settle" | |||
KEY_CFG_CRON_TIME_PDDBYCREATETIME = "crontab_order_time_pdd_by_create_time" | |||
KEY_CFG_CRON_TIME_JDBYCREATETIME = "crontab_order_time_jd_by_create_time" | |||
KEY_CFG_CRON_TIME_JDBYSUCCESS = "crontab_order_time_jd_by_success" | |||
KEY_CFG_CRON_TIME_JDFAILBYCREATETIME = "crontab_order_time_jd_fail_by_create_time" | |||
KEY_CFG_CRON_TIME_PDDBYAGOTIME = "crontab_order_time_pdd_by_ago_time" | |||
KEY_CFG_CRON_TIME_PDDBYSTATUSSUCCESS = "crontab_order_time_pdd_by_status_success" | |||
KEY_CFG_CRON_TIME_PDDBYSTATUSFAIL = "crontab_order_time_pdd_by_status_fail" | |||
KEY_CFG_CRON_TIME_PDDBYSTATUS = "crontab_order_time_pdd_by_status" | |||
KEY_CFG_CRON_TIME_JDBYSTATUS = "crontab_order_time_jd_by_status" | |||
KEY_CFG_CRON_TIME_SN = "crontab_order_time_suning" | |||
KEY_CFG_CRON_TIME_VIP = "crontab_order_time_vip" | |||
KEY_CFG_CRON_TIME_KL = "crontab_order_time_kaola" | |||
KEY_CFG_CRON_TIME_DUOMAI = "crontab_order_time_duomai" | |||
KEY_CFG_CRON_TIME_PUBLISHER = "crontab_taobao_time_publisher" // 跟踪淘宝备案信息绑定会员运营id 针对小程序 | |||
KEY_CFG_CRON_TIME_MEITUAN = "crontab_order_time_meituan" //美团 | |||
KEY_CFG_CRON_TIME_MEITUANLM = "crontab_order_time_meituan_lm" //美团联盟 | |||
KEY_CFG_CRON_TIME_MEITUANLMSTART = "crontab_order_time_meituan_lm_start" //美团联盟 | |||
KEY_CFG_CRON_TIME_MEITUANSTART = "crontab_order_time_meituan_start" //美团联盟 | |||
KEY_CFG_CRON_TIME_STATIONMEITUANLM = "crontab_order_time_station_meituan_lm" //美团联盟 | |||
KEY_CFG_CRON_TIME_OILSTATION = "crontab_order_time_oilstation" //加油 | |||
KEY_CFG_CRON_TIME_BRIGHT_OILSTATION = "crontab_order_time_bright_oilstation" //加油 | |||
KEY_CFG_CRON_TIME_KFC = "crontab_order_time_kfc" //肯德基 | |||
KEY_CFG_CRON_TIME_CINEMA = "crontab_order_time_cinema" //电影票 | |||
KEY_CFG_CRON_TIME_STARBUCKS = "crontab_order_time_starbucks" //海威星巴克 | |||
KEY_CFG_CRON_TIME_MCDONALD = "crontab_order_time_mcdonald" //海威麦当劳 | |||
KEY_CFG_CRON_TIME_NAYUKI = "crontab_order_time_nayuki" //海威奈雪 | |||
KEY_CFG_CRON_TIME_BURGERKING = "crontab_order_time_burger_king" //海威汉堡王 | |||
KEY_CFG_CRON_TIME_HEYTEA = "crontab_order_time_heytea" //海威喜茶 | |||
KEY_CFG_CRON_TIME_HWMOVIE = "crontab_order_time_hw_movie" //海威电影票 | |||
KEY_CFG_CRON_TIME_TIKTOKLIFE = "crontab_order_time_tik_tok_life" //海威电影票 | |||
KEY_CFG_CRON_TIME_PAGODA = "crontab_order_time_pagoda" // | |||
KEY_CFG_CRON_TIME_TO_KFC = "crontab_order_time_to_kfc" // | |||
KEY_CFG_CRON_TIME_LUCKIN = "crontab_order_time_luckin" // | |||
KEY_CFG_CRON_TIME_DIDI_ENERGY = "crontab_order_time_didi_energy" // | |||
KEY_CFG_CRON_TIME_T3_CAR = "crontab_order_time_t3_car" // | |||
KEY_CFG_CRON_TIME_DIDI_ONLINE_CAR = "crontab_order_time_didi_online_car" // | |||
KEY_CFG_CRON_TIME_KING_FLOWER = "crontab_order_time_king_flower" // | |||
KEY_CFG_CRON_TIME_DIDI_FREIGHT = "crontab_order_time_didi_freight" // | |||
KEY_CFG_CRON_TIME_DIDI_CHAUFFEUR = "crontab_order_time_didi_chauffeur" // | |||
KEY_CFG_CRON_USER_RELATE = "cron_user_relate" | |||
KEY_CFG_CRON_COMMUNITY_TEAM_ORDER_CANCEL = "community_team_cron_order_cancel" | |||
KEY_CFG_CRON_COMMUNITY_TEAM_ORDER_STORE_SETTLE = "community_team_cron_order_store_settle" | |||
KEY_CFG_CRON_COMMUNITY_TEAM_ORDER_SETTLE = "community_team_cron_order_settle" | |||
KEY_CFG_CRON_COMMUNITY_TEAM_ORDER_COMMISSION = "community_team_cron_order_commission" | |||
) |
@@ -0,0 +1,42 @@ | |||
package md | |||
import ( | |||
"regexp" | |||
"xorm.io/xorm" | |||
) | |||
type DbInfo struct { | |||
User string | |||
Psw string | |||
Name string | |||
Host string | |||
} | |||
func SplitDbInfo(eg *xorm.Engine) *DbInfo { | |||
if eg == nil { | |||
return &DbInfo{ | |||
User: "nil", | |||
Psw: "nil", | |||
Host: "nil", | |||
Name: "nil", | |||
} | |||
} | |||
pattern := `(\w+):(.*)@tcp\(([\w\.\-\:\_]+)\)\/(\w+)` | |||
reg := regexp.MustCompile(pattern).FindStringSubmatch(eg.DataSourceName()) | |||
if len(reg) < 5 { | |||
return &DbInfo{ | |||
User: "unknown", | |||
Psw: "unknown", | |||
Host: "unknown", | |||
Name: "unknown", | |||
} | |||
} | |||
return &DbInfo{ | |||
User: reg[1], | |||
Psw: reg[2], | |||
Host: reg[3], | |||
Name: reg[4], | |||
} | |||
} |
@@ -332,6 +332,12 @@ func OrderCancel(c *gin.Context) { | |||
e.OutErr(c, 400, e.NewErr(400, "订单不存在")) | |||
return | |||
} | |||
if order.State == 0 { | |||
now := time.Now().Unix() | |||
if now > order.CreateAt.Unix()+15*60 { | |||
order.State = 3 | |||
} | |||
} | |||
if order.State > 0 { | |||
sess.Rollback() | |||
e.OutErr(c, 400, e.NewErr(400, "订单不能取消")) | |||
@@ -368,7 +374,8 @@ func OrderCancel(c *gin.Context) { | |||
} | |||
order.State = 3 | |||
order.UpdateAt = time.Now() | |||
update, err := sess.Where("id=?", order.Id).Cols("state,update_at").Update(order) | |||
order.CancelAt = time.Now() | |||
update, err := sess.Where("id=?", order.Id).Cols("state,update_at,cancel_at").Update(order) | |||
if update == 0 || err != nil { | |||
sess.Rollback() | |||
e.OutErr(c, 400, e.NewErr(400, "订单取消失败")) | |||
@@ -419,7 +426,8 @@ func OrderConfirm(c *gin.Context) { | |||
} | |||
order.State = 2 | |||
order.UpdateAt = time.Now() | |||
update, err := sess.Where("id=?", order.Id).Cols("state,update_at").Update(order) | |||
order.ConfirmAt = time.Now() | |||
update, err := sess.Where("id=?", order.Id).Cols("state,confirm_at,update_at").Update(order) | |||
if update == 0 || err != nil { | |||
sess.Rollback() | |||
e.OutErr(c, 400, e.NewErr(400, "订单取消失败")) | |||
@@ -97,6 +97,7 @@ func StoreOrderList(c *gin.Context) { | |||
"state_str": state[v.State], | |||
"store_name": storeName, | |||
"coupon": v.Coupon, | |||
"commission": v.Commission, | |||
"username": nickname, | |||
"head_img": headImg, | |||
"amount": v.Amount, | |||
@@ -263,7 +264,8 @@ func StoreOrderConfirm(c *gin.Context) { | |||
} | |||
order.State = 2 | |||
order.UpdateAt = time.Now() | |||
update, err := sess.Where("id=?", order.Id).Cols("state,update_at").Update(order) | |||
order.ConfirmAt = time.Now() | |||
update, err := sess.Where("id=?", order.Id).Cols("state,confirm_at,update_at").Update(order) | |||
if update == 0 || err != nil { | |||
e.OutErr(c, 400, e.NewErr(400, "订单确认失败")) | |||
return | |||
@@ -14,57 +14,13 @@ import ( | |||
) | |||
var ( | |||
timer *cron.Cron | |||
jobs = map[string]func(*xorm.Engine, string){} | |||
baseEntryId cron.EntryID | |||
entryIds []cron.EntryID | |||
taskCfgList map[string]*[]model.SysCfg | |||
ch = make(chan int, 50) | |||
workerNum = 50 // 智盟跟单并发数量 | |||
orderStatWorkerNum = 50 // 智盟跟单并发数量 | |||
tbagoworkerNum = 50 // 智盟跟单并发数量 | |||
tbsettleworkerNum = 50 // 智盟跟单并发数量 | |||
pddOrderWorkerNum = 50 // 拼多多跟单并发数量 | |||
orderSuccessWorkerNum = 50 // | |||
tbOrderWorkerNum = 50 // 淘宝跟单并发数量 | |||
jdOrderWorkerNum = 50 // 京东跟单并发数量 | |||
wphOrderWorkerNum = 50 // 唯品会跟单并发数量 | |||
cardWorkerNum = 20 // 权益卡并发数量 | |||
tbRelationWorkerNum = 50 // 淘宝并发数量 | |||
hw365WorkerNum = 50 // 海威并发数量 | |||
hw365TourismWorkerNum = 50 // 海威并发数量 | |||
tbpubWorkerNum = 50 // 海威并发数量 | |||
liveWorkerNum = 50 // 海威并发数量 | |||
tikTokOwnWorkerNum = 50 // 海威并发数量 | |||
cardUpdateWorkerNum = 50 // 海威并发数量 | |||
lifeWorkerNum = 50 //生活服务跟单 | |||
pddWorkerNum = 50 // | |||
oilWorkerNum = 50 // | |||
otherWorkerNum = 50 // 淘宝, 苏宁, 考拉并发量 | |||
jdWorkerNum = 50 // | |||
tikTokWorkerNum = 50 // | |||
teamGoodsWorkerNum = 50 | |||
jdCh = make(chan int, 50) | |||
jdWorkerNum1 = 50 // | |||
orderStatCh = make(chan int, 50) | |||
jdCh1 = make(chan int, 50) | |||
oilCh = make(chan int, 50) | |||
otherCh = make(chan int, 50) | |||
otherTourismCh = make(chan int, 50) | |||
liveOtherCh = make(chan int, 50) | |||
teamGoodsCh = make(chan int, 50) | |||
tikTokOwnOtherCh = make(chan int, 50) | |||
cardUpdateCh = make(chan int, 50) | |||
tbpubCh = make(chan int, 50) | |||
cardCh = make(chan int, 20) | |||
pddCh = make(chan int, 50) | |||
tikTokCh = make(chan int, 50) | |||
tbRefundCh = make(chan int, 50) | |||
tbagodCh = make(chan int, 50) | |||
tbsettleCh = make(chan int, 50) | |||
pddFailCh = make(chan int, 50) | |||
orderSuccessCh = make(chan int, 50) | |||
tbRelationCh = make(chan int, 50) | |||
timer *cron.Cron | |||
jobs = map[string]func(*xorm.Engine, string){} | |||
baseEntryId cron.EntryID | |||
entryIds []cron.EntryID | |||
taskCfgList map[string]*[]model.SysCfg | |||
ch = make(chan int, 50) | |||
workerNum = 50 // 智盟跟单并发数量 | |||
) | |||
func Init() { | |||
@@ -152,149 +108,7 @@ func doTask(dbName, fnName string) func() { | |||
// 增加自动任务队列 | |||
func initTasks() { | |||
//v2 | |||
//jobs[md.KEY_CFG_CRON_BUCKLE] = taskOrderBuckle // | |||
//jobs[md.KEY_CFG_CRON_CHECK_BUCKLE_ORDER] = taskCheckBuckleOrder // | |||
//jobs[md.KEY_CFG_CRON_USER_RELATE] = taskUserRelate // | |||
//v3 | |||
//jobs[md.KEY_CFG_CRON_TB12] = taskOrderTaobao12 //淘宝抓单 | |||
//jobs[md.KEY_CFG_CRON_TBBYAGOTIME] = taskAgoOrderTB //用于恢复个别时间丢单的 | |||
//jobs[md.KEY_CFG_CRON_TB_PUNISH_REFUND] = taskTbPunishOrderRefund //淘宝退款订单处理 | |||
//jobs[md.KEY_CFG_CRON_TBREFUND] = taskTbOrderRefund //淘宝退款订单处理 | |||
//jobs[md.KEY_CFG_CRON_PUBLISHER_RELATION] = taskTaobaoPublisherRelation //获取渠道信息 | |||
//jobs[md.KEY_CFG_CRON_PUBLISHER_RELATION_NEW] = taskTaobaoPublisherRelationNew //获取渠道信息 | |||
//jobs[md.KEY_CFG_CRON_TBSETTLEORDER] = taskOrderTaobaoSettleOrder //淘宝抓单结算订单 | |||
//v4 | |||
//jobs[md.KEY_CFG_CRON_PDD_SUCC] = taskOrderPddSucc | |||
//jobs[md.KEY_CFG_CRON_PDDBYSTATUS] = taskOrderPddStatus | |||
//jobs[md.KEY_CFG_CRON_PDDBYSTATUSSUCCESS] = taskOrderPddStatusSuccess | |||
//jobs[md.KEY_CFG_CRON_PDDBYSTATUSFAIL] = taskOrderPddStatusFail | |||
//jobs[md.KEY_CFG_CRON_PDDBYLOOPTIME] = taskLoopOrderPdd //拼多多创建时间循环当天 | |||
//jobs[md.KEY_CFG_CRON_PDDREFUND] = taskPddOrderRefund //拼多多退款订单处理 | |||
//jobs[md.KEY_CFG_CRON_PDDBYAGOTIME] = taskAgoOrderPdd //用于恢复个别时间丢单的 | |||
//jobs[md.KEY_CFG_CRON_PDDBYCREATETIME] = taskOrderPddByCreateTime //拼多多创建时间跟踪订单 | |||
//jobs[md.KEY_CFG_CRON_PDD] = taskOrderPdd | |||
//v5-guide-settle | |||
//jobs[md.KEY_CFG_CRON_SETTLE] = taskOrderSettle // 结算 | |||
//v5 | |||
//jobs[md.KEY_CFG_CRON_FREE_SETTLE] = taskOrderFreeSettle // 结算 | |||
//jobs[md.KEY_CFG_CRON_SECOND_FREE_SETTLE] = taskOrderSecondFreeSettle // 结算 | |||
//jobs[md.KEY_CFG_CRON_THIRD_FREE_SETTLE] = taskOrderMoreFreeSettle // 结算 | |||
//jobs[md.KEY_CFG_CRON_AGGREGATION_RECHARGE_SETTLE] = taskAggregationRechargeSettle // | |||
//jobs[md.KEY_CFG_CRON_PLAYLET_SETTLE] = taskAggregationPlaylet // | |||
//jobs[md.KEY_CFG_CRON_DUOYOUORD_SETTLE] = taskDuoYouSettle // | |||
//jobs[md.KEY_CFG_CRON_LIANLIAN_SETTLE] = taskLianlianSettle // | |||
//jobs[md.KEY_CFG_CRON_SWIPE_SETTLE] = taskSwipeSettle // | |||
//jobs[md.KEY_CFG_CRON_USER_LV_UP_SETTLE] = taskUserLvUpOrderSettle // 会员费订单结算 | |||
//jobs[md.KEY_CFG_CRON_PRIVILEGE_CARD_SETTLE] = taskPrivilegeCardOrderSettle // 权益卡订单结算 | |||
//jobs[md.KEY_CFG_CRON_ACQUISITION_CONDITION] = taskAcquisitionCondition | |||
//jobs[md.KEY_CFG_CRON_ACQUISITION_CONDITION_BY_LV] = taskAcquisitionConditionByLv | |||
//jobs[md.KEY_CFG_CRON_ACQUISITION_REWARD] = taskAcquisitionReward | |||
//jobs[md.KEY_CFG_CRON_NEW_ACQUISTION_SETTLE] = taskNewAcquisition // 拉新 | |||
//jobs[md.KEY_CFG_CRON_ACQUISTION_SETTLE] = taskAcquisition // 拉新 | |||
//jobs[md.KEY_CFG_VERIFY] = taskVerify //团长 | |||
//v7 | |||
//jobs[md.KEY_CFG_CRON_JD] = taskOrderJd | |||
//jobs[md.KEY_CFG_CRON_JDFAILBYCREATETIME] = taskOrderJDFailByCreateTime //拼多多创建时间跟踪订单 | |||
//jobs[md.KEY_CFG_CRON_JDBYCREATETIME] = taskOrderJDByCreateTime //拼多多创建时间跟踪订单 | |||
//jobs[md.KEY_CFG_CRON_JDBYSUCCESS] = taskOrderJDBySuccess //拼多多创建时间跟踪订单 | |||
//jobs[md.KEY_CFG_CRON_ORDER_SUCCESS_CHECK] = taskOrderSuccessCheck // | |||
//jobs[md.KEY_CFG_CRON_JDBYSTATUS] = taskOrderJdStatus | |||
//jobs[md.KEY_CFG_CRON_JDREFUND] = taskJdOrderRefund //京东退款订单处理 | |||
//v6 | |||
jobs[md.KEY_CFG_CRON_TIKTOKLIFE] = taskOrderTikTokLife //抖音本地生活 | |||
jobs[md.KEY_CFG_KUAISHOU_AUTH] = taskKuaishouAuth //团长 | |||
jobs[md.KEY_CFG_TIK_TOK_TEAM_ORDER_PAY] = taskTikTokTeamOrder //团长 | |||
jobs[md.KEY_CFG_TIK_TOK_TEAM_ORDER_UPDATE] = taskTikTokTeamOrderUpdate //团长 | |||
jobs[md.KEY_CFG_TIK_TOK_TEAM_USER_BIND_BUYINID] = taskTikTokTeamUserBindBuyinid //达人buyin_id | |||
jobs[md.KEY_CFG_KUAISHOU_TEAM_ORDER_PAY] = taskKuaishouTeamOrder //团长 | |||
jobs[md.KEY_CFG_KUAISHOU_TEAM_ORDER_UPDATE] = taskKuaishouTeamOrderUpdate //团长 | |||
jobs[md.KEY_CFG_CRON_AUTO_ADD_TIKTOK_GOODS] = taskAutoAddTikTokGoods // | |||
jobs[md.KEY_CFG_CRON_KuaishouOwn] = taskOrderKuaishouOwn // | |||
jobs[md.KEY_CFG_CRON_KuaishouOwnCreate] = taskOrderKuaishouOwnCreate // | |||
jobs[md.KEY_CFG_CRON_KUAISHOU] = taskOrderKuaishou // | |||
jobs[md.KEY_CFG_CRON_KUAISHOULIVE] = taskOrderKuaishouLive // | |||
jobs[md.KEY_CFG_CRON_TIKTOKCsjp] = taskOrderTIKTokCsjp // | |||
jobs[md.KEY_CFG_CRON_TIKTOKCsjpLive] = taskOrderTIKTokCsjpLive // | |||
jobs[md.KEY_CFG_CRON_TIKTOKOwnCsjp] = taskOrderTIKTokOwnCsjp // | |||
jobs[md.KEY_CFG_CRON_TIKTOKOwnCsjpLive] = taskOrderTIKTokOwnCsjpLive // | |||
jobs[md.KEY_CFG_CRON_TIKTOKOwnCsjpActivity] = taskOrderTIKTokOwnCsjpActivity // | |||
jobs[md.KEY_CFG_CRON_KUAISHOUOFFICIAL] = taskOrderKuaishouOfficial // | |||
jobs[md.KEY_CFG_CRON_KUAISHOUOFFICIALLive] = taskOrderKuaishouOfficialLive // | |||
//v8 | |||
//jobs[md.KEY_CFG_CRON_MEITUANLM_START] = taskOrderMeituanLmStart //智盟返回的美团联盟 | |||
//jobs[md.KEY_CFG_CRON_MEITUAN_START] = taskOrderMeituanStart //智盟返回的美团联盟 | |||
//jobs[md.KEY_CFG_CRON_MEITUAN] = taskOrderMeituan | |||
//jobs[md.KEY_CFG_CRON_MEITUANLM] = taskOrderMeituanLm //智盟返回的美团联盟 | |||
//jobs[md.KEY_CFG_CRON_STATIONMEITUANLM] = taskOrderStationMeituanLm //站长自己美团联盟 | |||
//jobs[md.KEY_CFG_CRON_MEITUANOFFICIAL] = taskOrderMeituanOfficial //站长自己美团联盟 | |||
//v9 | |||
//jobs[md.KEY_CFG_CRON_ELM] = taskOrderElm // | |||
//jobs[md.KEY_CFG_CRON_HEYTEA] = taskOrderHeytea //海威365喜茶 | |||
//jobs[md.KEY_CFG_CRON_PIZZA] = taskOrderPizza //海威365 | |||
//jobs[md.KEY_CFG_CRON_WALLACE] = taskOrderWallace //海威365 | |||
//jobs[md.KEY_CFG_CRON_TOURISM] = taskOrderTourism //海威365 | |||
//jobs[md.KEY_CFG_CRON_FLOWERCAKE] = taskOrderFlowerCake //海威365 | |||
//jobs[md.KEY_CFG_CRON_DELIVERY] = taskOrderDelivery //海威365 | |||
//jobs[md.KEY_CFG_CRON_BURGERKING] = taskOrderBurgerKing //海威365汉堡王 | |||
//jobs[md.KEY_CFG_CRON_STARBUCKS] = taskOrderStarbucks //海威365星巴克 | |||
//jobs[md.KEY_CFG_CRON_MCDONALD] = taskOrderMcdonald //海威365麦当劳 | |||
//jobs[md.KEY_CFG_CRON_HWMOVIE] = taskOrderHwMovie //海威365电影票 | |||
//jobs[md.KEY_CFG_CRON_NAYUKI] = taskOrderNayuki //海威365奈雪 | |||
//jobs[md.KEY_CFG_CRON_TO_KFC] = taskOrderToKfc //海威365 | |||
//jobs[md.KEY_CFG_CRON_PAGODA] = taskOrderPagoda //海威365 | |||
//jobs[md.KEY_CFG_CRON_LUCKIN] = taskOrderLuckin //海威365 | |||
//v10 | |||
////jobs[md.KEY_CFG_CRON_WPHREFUND] = taskWphOrderRefund //唯品会退款订单处理 | |||
////jobs[md.KEY_CFG_CRON_VIP] = taskOrderVip | |||
//jobs[md.KEY_CFG_CRON_KFC] = taskOrderKfc | |||
//jobs[md.KEY_CFG_CRON_CINEMA] = taskOrderCinema | |||
//jobs[md.KEY_CFG_CRON_DUOMAI] = taskOrderDuomai //多麦跟单 | |||
//jobs[md.KEY_CFG_CRON_PLAYLET_ORDER] = taskPlayletOrder | |||
//jobs[md.KEY_CFG_CRON_DIDI_ENERGY] = taskOrderDidiEnergy //滴滴加油 | |||
//jobs[md.KEY_CFG_CRON_T3_CAR] = taskOrderT3Car //T3打车 | |||
//jobs[md.KEY_CFG_CRON_DIDI_ONLINE_CAR] = taskOrderDidiOnlineCar //滴滴网约车 | |||
//jobs[md.KEY_CFG_CRON_KING_FLOWER] = taskOrderKingFlower //滴滴网约车 | |||
//jobs[md.KEY_CFG_CRON_DIDI_FREIGHT] = taskOrderDidiFreight //滴滴货运 | |||
//jobs[md.KEY_CFG_CRON_DIDI_CHAUFFEUR] = taskOrderDidiChauffeur //滴滴代驾 | |||
//jobs[md.KEY_CFG_CRON_OILSTATION] = taskOrderOilstation | |||
//jobs[md.KEY_CFG_CRON_BRIGHTOILSTATION] = taskOrderBrightOilstation | |||
//jobs[md.KEY_CFG_CRON_SN] = taskOrderSuning | |||
//jobs[md.KEY_CFG_CRON_KL] = taskOrderKaola | |||
////原来的 | |||
//jobs[md.KEY_CFG_CRON_PlayLet_Total] = taskPlayletTotal // | |||
//jobs[md.KEY_CFG_CRON_CHECK_GUIDE_STORE_ORDER] = taskCheckGuideStoreOrder // | |||
//jobs[md.KEY_CFG_CRON_FAST_REFUND] = taskOrderFastRefund // | |||
//jobs[md.KEY_CFG_CRON_FAST_SUCCESS] = taskOrderFastSuccess // | |||
//jobs[md.KEY_CFG_CRON_DUOYOUORD] = taskOrderDuoYouOrd // | |||
//jobs[md.KEY_CFG_CRON_TASKBOX] = taskOrderTaskBoxOrd // | |||
//jobs[md.KEY_CFG_CRON_TASKBOXSECOND] = taskOrderTaskSecondOrd // | |||
//jobs[md.KEY_CFG_CRON_CARD_CHECK_UPDATE] = taskCardCheckUpdate //权益卡退款 | |||
//jobs[md.KEY_CFG_CRON_CARD_UPDATE] = taskCardUpdate // 权益卡更新 | |||
//jobs[md.KEY_CFG_CRON_ORDER_STAT] = taskOrderStat // 订单统计 | |||
//jobs[md.KEY_CFG_CRON_GOODS_SHELF] = taskGoodsShelf //站内商品上下架 | |||
//jobs[md.KEY_CFG_CRON_CARD_RETURN] = taskCardReturn //权益卡退款 | |||
//jobs[md.KEY_CFG_CRON_DTKBRAND] = taskTaoKeBrandInfo // 大淘客品牌信息 | |||
//jobs[md.KEY_CFG_CRON_PUBLISHER] = taskTaobaoPublisherInfo // 淘宝备案信息绑定 | |||
//jobs[md.KEY_CFG_CRON_AUTO_UN_FREEZE] = taskAutoUnFreeze // 定时解冻 | |||
//先不用 | |||
//jobs[md.ZhimengCronPlayletVideoOrder] = taskPlayletVideoOrder // | |||
//jobs[md.ZhimengCronPlayletVideoOrderYesterDay] = taskPlayletVideoOrderYesterday // | |||
//jobs[md.ZhimengCronPlayletVideoOrderMonth] = taskPlayletVideoOrderMonth // | |||
//jobs[md.ZhimengCronPlayletAdvOrderMonth] = taskPlayletAdvOrderMonth // | |||
//jobs[md.ZhimengCronPlayletAdvOrder] = taskPlayletAdvOrder // | |||
//jobs[md.ZhimengCronPlayletAdvOrderYesterDay] = taskPlayletAdvOrderYesterday // | |||
//jobs[md.ZhimengCronPlayletAdvOrderYesterDayToMoney] = taskPlayletAdvOrderYesterdayToMoney // | |||
jobs[md.KEY_CFG_CRON_COMMUNITY_TEAM_ORDER_CANCEL] = taskOrderCancel // | |||
jobs[md.KEY_CFG_CRON_COMMUNITY_TEAM_ORDER_STORE_SETTLE] = taskOrderStoreSettle // | |||
} |
@@ -0,0 +1,13 @@ | |||
package svc | |||
import ( | |||
"applet/app/db/model" | |||
"time" | |||
"xorm.io/xorm" | |||
) | |||
func OrderCancel(eg *xorm.Engine, dbName string) { | |||
date := time.Now().Unix() - 900 | |||
eg.Where("state=0 and create_at<?", time.Unix(date, 0).Format("2006-01-02 15:04:05")).Cols("state").Update(&model.CommunityTeamOrder{State: 3, CancelAt: time.Now()}) | |||
return | |||
} |
@@ -0,0 +1,114 @@ | |||
package svc | |||
import ( | |||
"applet/app/db" | |||
"applet/app/db/model" | |||
"applet/app/svc" | |||
"applet/app/utils" | |||
"applet/app/utils/cache" | |||
"applet/app/utils/logx" | |||
zhios_third_party_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_third_party_api.git/utils" | |||
"fmt" | |||
"time" | |||
"xorm.io/xorm" | |||
) | |||
func OrderStoreSettle(eg *xorm.Engine, dbName string) { | |||
var data []model.CommunityTeamOrder | |||
eg.Where("state=2 and store_settle_at=0 and commission>0 and store_type=0").Limit(20).Find(&data) | |||
for _, v := range data { | |||
doing(eg, dbName, v) | |||
} | |||
return | |||
} | |||
func doing(eg *xorm.Engine, dbName string, order model.CommunityTeamOrder) { | |||
// 加锁 防止并发提取 | |||
mutexKey := fmt.Sprintf("%s:task.CommunityTeamOrderStoreSettle:%d", dbName, order.Id) | |||
withdrawAvailable, err := cache.Do("SET", mutexKey, 1, "EX", 5, "NX") | |||
if err != nil { | |||
return | |||
} | |||
if withdrawAvailable != "OK" { | |||
return | |||
} | |||
sess := eg.NewSession() | |||
defer sess.Close() | |||
sess.Begin() | |||
orderData := db.GetOrder(sess, zhios_third_party_utils.Int64ToStr(order.Oid)) | |||
if orderData.StoreSettleAt > 0 { | |||
sess.Rollback() | |||
return | |||
} | |||
orderData.StoreSettleAt = int(time.Now().Unix()) | |||
update, err := sess.Where("id=?", orderData.Id).Cols("store_settle_at").Update(orderData) | |||
if update == 0 || err != nil { | |||
sess.Rollback() | |||
return | |||
} | |||
//给钱 | |||
bools := CommSettleMoney(sess, utils.IntToStr(orderData.StoreUid), orderData.Commission, dbName, orderData.Oid) | |||
if bools == false { | |||
sess.Rollback() | |||
return | |||
} | |||
sess.Commit() | |||
return | |||
} | |||
func CommSettleMoney(session *xorm.Session, uid, amount, dbName string, oid int64) bool { | |||
// 拿到锁才能进行余额操作 | |||
// 获取余额更新锁 | |||
cb, err := svc.HandleBalanceDistributedLock(dbName, uid, "settle_order") | |||
if err != nil { | |||
fmt.Println(err) | |||
return false | |||
} | |||
// 释放锁 | |||
if cb != nil { | |||
defer cb() | |||
} | |||
now := time.Now() | |||
beforeAmount := "0" | |||
afterAmount := "0" | |||
var affected int64 = 0 | |||
userProfile, err := db.UserProfileFindByIdWithSession(session, utils.StrToInt(uid)) | |||
if err != nil || userProfile == nil { | |||
//_ = session.Rollback() | |||
return true | |||
} | |||
// 开始写入流水 | |||
var orderAction = 300 | |||
ItemTitle := "门店提成" | |||
finUserFlow := model.FinUserFlow{ | |||
Type: 0, | |||
Uid: utils.StrToInt(uid), | |||
Amount: amount, | |||
BeforeAmount: beforeAmount, | |||
AfterAmount: afterAmount, | |||
OrdType: "community_team_store", | |||
OrdId: utils.Int64ToStr(oid), | |||
OrdAction: orderAction, | |||
OrdDetail: utils.Int64ToStr(oid), | |||
State: 2, | |||
OtherId: oid, | |||
OrdTitle: ItemTitle, | |||
OrdTime: int(now.Unix()), | |||
CreateAt: now, | |||
UpdateAt: now, | |||
} | |||
// 更新用户余额 | |||
finUserFlow.BeforeAmount = userProfile.FinValid | |||
userProfile.FinValid = utils.Float64ToStrByPrec(utils.AnyToFloat64(userProfile.FinValid)+utils.StrToFloat64(amount), 9) | |||
userProfile.FinTotal = userProfile.FinTotal + utils.StrToFloat32(utils.Float64ToStrByPrec(utils.StrToFloat64(amount), 9)) | |||
affected, err = db.UserProfileUpdateWithSession(session, uid, userProfile, "fin_valid", "fin_total") | |||
finUserFlow.AfterAmount = userProfile.FinValid | |||
has, errs := db.InsertCommWithSession( | |||
session, &finUserFlow) | |||
if affected == 0 || err != nil || errs != nil || has == 0 { | |||
_ = session.Rollback() | |||
_ = logx.Warn(err) | |||
return false | |||
} | |||
return true | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
"xorm.io/xorm" | |||
) | |||
func taskOrderCancel(eg *xorm.Engine, dbName string) { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.OrderCancel(eg, dbName) | |||
<-ch | |||
} |
@@ -0,0 +1,22 @@ | |||
package task | |||
import ( | |||
"applet/app/task/svc" | |||
"math/rand" | |||
"time" | |||
"xorm.io/xorm" | |||
) | |||
func taskOrderStoreSettle(eg *xorm.Engine, dbName string) { | |||
for { | |||
if len(ch) > workerNum { | |||
time.Sleep(time.Millisecond * time.Duration(rand.Intn(1000))) | |||
} else { | |||
goto START | |||
} | |||
} | |||
START: | |||
ch <- 1 | |||
svc.OrderStoreSettle(eg, dbName) | |||
<-ch | |||
} |
@@ -16,8 +16,6 @@ func init() { | |||
cfg.InitTaskCfg() | |||
cfg.InitLog() | |||
cfg.InitCache() | |||
cfg.InitCacheSecond() | |||
cfg.InitEs() //ElasticSearch初始化 | |||
cfg.InitMq() | |||
baseDb := *cfg.DB | |||
baseDb.Path = fmt.Sprintf(cfg.DB.Path, cfg.DB.Name) | |||