bb
This commit is contained in:
BIN
web/controllers/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/__pycache__/chart.cpython-39.pyc
Normal file
BIN
web/controllers/__pycache__/chart.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/__pycache__/index.cpython-39.pyc
Normal file
BIN
web/controllers/__pycache__/index.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/__pycache__/static.cpython-39.pyc
Normal file
BIN
web/controllers/__pycache__/static.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/account/__pycache__/Account.cpython-39.pyc
Normal file
BIN
web/controllers/account/__pycache__/Account.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/account/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/account/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
# -*- coding: utf-8 -*-
|
||||
from web.controllers.api import route_api
|
||||
from flask import request,jsonify,g
|
||||
@@ -162,3 +163,169 @@ def memberInfo():
|
||||
"avatar_url":member_info.avatar
|
||||
}
|
||||
return jsonify(resp)
|
||||
=======
|
||||
# -*- coding: utf-8 -*-
|
||||
from web.controllers.api import route_api
|
||||
from flask import request,jsonify,g
|
||||
from application import app,db
|
||||
import requests,json
|
||||
from common.models.member.Member import Member
|
||||
from common.models.member.Mendianuserinfo import Mendianuserinfo
|
||||
from common.models.member.Memberinfoo import Memberinfoo
|
||||
from common.models.member.Membermiya import Membermiya
|
||||
from common.models.member.OauthMemberBind import OauthMemberBind
|
||||
from common.models.food.WxShareHistory import WxShareHistory
|
||||
from common.libs.Helper import getCurrentDate
|
||||
from common.libs.member.MemberService import MemberService
|
||||
|
||||
@route_api.route("/member/login",methods = [ "GET","POST" ])
|
||||
def login():
|
||||
resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
|
||||
req = request.values
|
||||
code = req['code'] if 'code' in req else ''
|
||||
app.logger.info(code)
|
||||
if not code or len(code) < 1:
|
||||
resp['code'] = -1
|
||||
resp['msg'] = "需要code"
|
||||
return jsonify(resp)
|
||||
openid = MemberService.getWeChatOpenId(code)
|
||||
app.logger.info(openid)
|
||||
if openid is None:
|
||||
resp['code'] = -1
|
||||
resp['msg'] = "调用微信出错"
|
||||
return jsonify(resp)
|
||||
nickname = req['nickName'] if 'nickName' in req else ''
|
||||
sex = req['gender'] if 'gender' in req else 0
|
||||
avatar = req['avatarUrl'] if 'avatarUrl' in req else ''
|
||||
'''
|
||||
判断是否已经测试过,注册了直接返回一些信息
|
||||
'''
|
||||
bind_info = OauthMemberBind.query.filter_by(openid=openid, type=1).first()
|
||||
if not bind_info:
|
||||
model_member = Member()
|
||||
model_member.nickname = nickname
|
||||
model_member.sex = sex
|
||||
model_member.avatar = avatar
|
||||
model_member.salt = MemberService.geneSalt()
|
||||
model_member.updated_time = model_member.created_time = getCurrentDate()
|
||||
db.session.add(model_member)
|
||||
db.session.commit()
|
||||
|
||||
model_bind = OauthMemberBind()
|
||||
model_bind.member_id = model_member.id
|
||||
model_bind.type = 1
|
||||
model_bind.openid = openid
|
||||
model_bind.extra = ''
|
||||
model_bind.updated_time = model_bind.created_time = getCurrentDate()
|
||||
db.session.add(model_bind)
|
||||
db.session.commit()
|
||||
|
||||
bind_info = model_bind
|
||||
member_info = Member.query.filter_by(id=bind_info.member_id).first()
|
||||
token = "%s#%s" % (MemberService.geneAuthCode(member_info), member_info.id)
|
||||
resp['data'] = {'token': token}
|
||||
return jsonify(resp)
|
||||
|
||||
@route_api.route("/member/logintwo",methods = [ "GET","POST" ])
|
||||
def logintwo():
|
||||
resp = {'code': 200, 'msg': 'rjb操作成功~', 'data': {}}
|
||||
req = request.values
|
||||
app.logger.info(req)
|
||||
name = req['name'] if 'name' in req else ''
|
||||
app.logger.info(name)
|
||||
phone = req['phone'] if 'phone' in req else 0
|
||||
app.logger.info(phone)
|
||||
storename = req['storename'] if 'storename' in req else ''
|
||||
app.logger.info(storename)
|
||||
|
||||
name_info = Mendianuserinfo.query.filter_by(nickname=name).first()
|
||||
if not name_info:
|
||||
model_mendianuserinfo = Mendianuserinfo()
|
||||
model_mendianuserinfo.nickname = name
|
||||
model_mendianuserinfo.mobile = phone
|
||||
model_mendianuserinfo.storename = storename
|
||||
db.session.add(model_mendianuserinfo)
|
||||
db.session.commit()
|
||||
return jsonify(resp)
|
||||
|
||||
@route_api.route("/member/loginmiya",methods = [ "GET","POST" ])
|
||||
def loginmiya():
|
||||
resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
|
||||
req = request.values
|
||||
app.logger.info(req)
|
||||
name = req['nickname'] if 'nickname' in req else ''
|
||||
app.logger.info(name)
|
||||
mobile = req['mobile'] if 'mobile' in req else 0
|
||||
app.logger.info(mobile)
|
||||
token = req['token'] if 'token' in req else ''
|
||||
app.logger.info(token)
|
||||
|
||||
miya_info = Membermiya.query.filter_by(nickname=name).first()
|
||||
if not miya_info:
|
||||
model_membermiya = Membermiya()
|
||||
model_membermiya.nickname = name
|
||||
model_membermiya.mobile = mobile
|
||||
model_membermiya.token = token
|
||||
db.session.add(model_membermiya)
|
||||
db.session.commit()
|
||||
return jsonify(resp)
|
||||
|
||||
|
||||
@route_api.route("/member/check-reg",methods = [ "GET","POST" ])
|
||||
def checkReg():
|
||||
resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
|
||||
req = request.values
|
||||
code = req['code'] if 'code' in req else ''
|
||||
if not code or len(code) < 1:
|
||||
resp['code'] = -1
|
||||
resp['msg'] = "需要code"
|
||||
return jsonify(resp)
|
||||
|
||||
openid = MemberService.getWeChatOpenId(code)
|
||||
if openid is None:
|
||||
resp['code'] = -1
|
||||
resp['msg'] = "调用微信出错"
|
||||
return jsonify(resp)
|
||||
|
||||
bind_info = OauthMemberBind.query.filter_by(openid=openid, type=1).first()
|
||||
if not bind_info:
|
||||
resp['code'] = -1
|
||||
resp['msg'] = "未绑定"
|
||||
return jsonify(resp)
|
||||
|
||||
member_info = Member.query.filter_by( id = bind_info.member_id).first()
|
||||
if not member_info:
|
||||
resp['code'] = -1
|
||||
resp['msg'] = "未查询到绑定信息"
|
||||
return jsonify(resp)
|
||||
|
||||
token = "%s#%s"%( MemberService.geneAuthCode( member_info ),member_info.id )
|
||||
resp['data'] = { 'token':token }
|
||||
return jsonify(resp)
|
||||
|
||||
@route_api.route("/member/share",methods = [ "POST" ])
|
||||
def memberShare():
|
||||
resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
|
||||
req = request.values
|
||||
url = req['url'] if 'url' in req else ''
|
||||
member_info = g.member_info
|
||||
model_share = WxShareHistory()
|
||||
if member_info:
|
||||
model_share.member_id = member_info.id
|
||||
model_share.share_url = url
|
||||
model_share.created_time = getCurrentDate()
|
||||
db.session.add(model_share)
|
||||
db.session.commit()
|
||||
return jsonify(resp)
|
||||
|
||||
|
||||
@route_api.route("/member/info")
|
||||
def memberInfo():
|
||||
resp = {'code': 200, 'msg': '操作成功~', 'data': {}}
|
||||
member_info = g.member_info
|
||||
resp['data']['info'] = {
|
||||
"nickname":member_info.nickname,
|
||||
"avatar_url":member_info.avatar
|
||||
}
|
||||
return jsonify(resp)
|
||||
>>>>>>> f69eff95df939a1f840036c96bddb29290a52715
|
||||
|
||||
BIN
web/controllers/api/__pycache__/Address.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/Address.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/Cart.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/Cart.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/Food.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/Food.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/Jieshao.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/Jieshao.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/Member.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/Member.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/My.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/My.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/Order.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/Order.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/api/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/api/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/finance/__pycache__/Finance.cpython-39.pyc
Normal file
BIN
web/controllers/finance/__pycache__/Finance.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/finance/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/finance/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/food/__pycache__/Food.cpython-39.pyc
Normal file
BIN
web/controllers/food/__pycache__/Food.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/food/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/food/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/furniture/__pycache__/Furniture.cpython-39.pyc
Normal file
BIN
web/controllers/furniture/__pycache__/Furniture.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/furniture/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/furniture/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/member/__pycache__/Member.cpython-39.pyc
Normal file
BIN
web/controllers/member/__pycache__/Member.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/member/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/member/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/stat/__pycache__/Stat.cpython-39.pyc
Normal file
BIN
web/controllers/stat/__pycache__/Stat.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/stat/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/stat/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/upload/__pycache__/Upload.cpython-39.pyc
Normal file
BIN
web/controllers/upload/__pycache__/Upload.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/user/__pycache__/User.cpython-39.pyc
Normal file
BIN
web/controllers/user/__pycache__/User.cpython-39.pyc
Normal file
Binary file not shown.
BIN
web/controllers/user/__pycache__/__init__.cpython-39.pyc
Normal file
BIN
web/controllers/user/__pycache__/__init__.cpython-39.pyc
Normal file
Binary file not shown.
Reference in New Issue
Block a user