Commit c2f9c745 authored by tarak.li's avatar tarak.li

自动出金二期,商城自动部署

parent bbb77cf6
......@@ -292,17 +292,23 @@ controllers = [
# 绑定支付宝账户
(r'/plugin/bind_pay_account', plugin.BindPayAccountHandler),
# 账户状态
(r'/micro_remote/plugin/account_status', plugin.AccountStatusHandler),
(r'/plugin/account_status', plugin.AccountStatusHandler),
# 主机监控状态
(r'/plugin/host_monitor', plugin.HostMonitorHandler),
# 账户账户密码获取
(r'/micro_remote/plugin/account_info', plugin.AccountInfoHandler),
(r'/plugin/account_info', plugin.AccountInfoHandler),
# 商城狀態查詢
(r'/plugin/shop_info', plugin.ShopInfoHandler),
# 商城綁定接口
(r'/plugin/shop_bind', plugin.ShopBindHandler),
# 密码修改
(r'/plugin/password_update', plugin.PasswordUpdateHandler),
# 下载地址获取接口
(r'/plugin/bat_download_url', plugin.BatDownloadHandler),
# websocket for real-time information
# ws-client call 'http://ip:7190/ws/action/'
(r'/ws/(.*)', ws.WebSocketHandler),
(r'/.*', index.CatchAllHandler),
]
......
......@@ -66,6 +66,25 @@ def get_bind_info(host_id):
return bind
def get_shop_bind_info(host_id):
s = SQL(get_db())
s.select_from('remote_shop_bind',
['host_id', 'name', 'domain', 'url', 'status', 'username', 'password',
'remark', 'create_time'], alt_name='a')
# 判断
if host_id:
s.where('a.host_id in ({host_ids})'.format(host_ids=','.join(host_id)))
err = s.query()
if err != TPE_OK:
return err, None
bind = s.recorder
for item in bind:
item['password'] = "******"
return bind
def get_account_info(host_id, mch_no):
s = SQL(get_db())
s.select_from('remote_account_host_bind',
......@@ -394,3 +413,30 @@ def update(table: str, fields: dict, where: dict):
return TPE_DATABASE
return TPE_OK
def add_shop_bind(handler, args):
db = get_db()
_time_now = tp_timestamp_utc_now()
operator = handler.get_current_user()
sql = 'INSERT INTO `tp_remote_shop_bind` (host_id, name, domain, url, status, username, password, remark, create_time, create_by, update_time, update_by) VALUES ' \
'({host_id}, "{name}", "{domain}", "{url}", {status}, "{username}", "{password}", "{remark}", "{create_time}", "{create_by}", "{update_time}", "{update_by}");' \
''.format(host_id=args.get("host_id", 0), name=args.get("name", ""), domain=args.get("domain", ""),
url=args.get("url", ""), status=args.get("status", 0), username=args.get("username", ""),
password=args.get("password", ""), remark=args.get("remark", ""), create_time=_time_now,
create_by=operator['id'], update_time=_time_now, update_by=operator['id'], )
db_ret = db.exec(sql)
if not db_ret:
return TPE_DATABASE, 0
_id = db.last_insert_id()
# acc_name = '{}@{}'.format(args['username'], args['host_ip'])
# if len(args['router_ip']) > 0:
# acc_name += '(由{}:{}路由)'.format(args['router_ip'], args['router_port'])
# syslog.sys_log(operator, handler.request.remote_ip, TPE_OK, "创建账号:{}".format(acc_name))
# 更新主机相关账号数量
return TPE_OK, _id
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