add ad
This commit is contained in:
parent
314a17faef
commit
5d0d0ac816
@ -102,11 +102,21 @@ class CompanyList(Resource):
|
|||||||
return jsonify({'code': 1, 'body': company_redis.lrang("ALL_Company", 0, -1)})
|
return jsonify({'code': 1, 'body': company_redis.lrang("ALL_Company", 0, -1)})
|
||||||
|
|
||||||
def post(self):
|
def post(self):
|
||||||
args = parser.parse_args()
|
companys = self.get_company()
|
||||||
log.info(f"args was {args}")
|
if companys:
|
||||||
try:
|
return jsonify({'code': 1, 'body': companys})
|
||||||
company_redis.rpush("ALL_Company", args['company'])
|
else:
|
||||||
except Exception:
|
|
||||||
log.error("Insert values to redis failed,args was {}!".format(args), exc_info=True)
|
|
||||||
return jsonify({'code': 0})
|
return jsonify({'code': 0})
|
||||||
return jsonify({'code': 1})
|
|
||||||
|
|
||||||
|
def get_company(self):
|
||||||
|
sel_sql = "select id from company where 1;"
|
||||||
|
data = mydb.query(sel_sql)
|
||||||
|
company_list = []
|
||||||
|
if data:
|
||||||
|
for item in data:
|
||||||
|
try:
|
||||||
|
company_list.append(item[0])
|
||||||
|
except Exception:
|
||||||
|
log.error("split data from db failed!", exc_info=True)
|
||||||
|
return company_list
|
||||||
|
Loading…
x
Reference in New Issue
Block a user