Commit 7b3f72ea authored by wwccw0591's avatar wwccw0591

clientAndUpdateBridge

parent a7744362
......@@ -60,6 +60,7 @@ class ApiConst
const zero = 0;
const one = 1;
const two = 2;
const four=4;
const cannotSendMsg=-1;
const canSendMsg=1;
......@@ -226,6 +227,9 @@ class ApiConst
const bySeller = 1;
const express = 2;
const oneHandred=100;
const oneHandredOne=101;
//文案类型
const buyerText = 1;
const storeText = 2;
......@@ -343,7 +347,8 @@ class ApiConst
const addGoodsToCart = 1; //将商品加入购物车
const addBundingToCart = 2; //将组合销售商品加入购物车
const positionPickupCodeBegin=12;
const positionPickupCodeBeginMysql=13;
const onlineGoodsState = 1;//正常商品状态
const onlineGoodsVerify = 1; //商品已通过审核
const onlineGoodsDel = 0; //商品未删除
......
......@@ -168,6 +168,8 @@ class NameConst {
const frontPrefix = 'front';
const blGoods = '_goodsCommon';
const pcClient='pc-client';
}
?>
\ No newline at end of file
......@@ -57,8 +57,8 @@ class ApiReciverInfoModel extends \DAO\AbstractModel
$this->address=$reciverInfo['address'];
$this->areaInfo=$reciverInfo['area'];
$this->street=$reciverInfo['street'];
$this->lng=$reciverInfo['lng'];
$this->lat=$reciverInfo['lat'];
$this->lng=isset($reciverInfo['lng'])?$reciverInfo['lng']:ApiConst::zero;
$this->lat=isset($reciverInfo['lat'])?$reciverInfo['lat']:ApiConst::zero;
$this->cityCode=isset($reciverInfo['citycode'])?$reciverInfo['citycode']:'';
$this->addressId=$reciverInfo['address_id'];
$this->subAddress=isset($reciverInfo['subaddress'])?$reciverInfo['subaddress']:'';
......
......@@ -61,7 +61,7 @@ class DiliverymanModel extends \DAO\AbstractModel
*/
public function find($where)
{
$data = $this->db->from($this->_tableName)->where($where)->fetchOne();
$data = $this->db->from($this->_tableName)->select($this->detailField)->where($where)->fetchOne();
return $data;
}
//任务脚本方法
......@@ -80,17 +80,31 @@ class DiliverymanModel extends \DAO\AbstractModel
$where[$this->_primaryKey] = $id;
return $this->find($where);
}
public function convert($info,$keyValues,$imageField='qrcode_path'){
$convertInfo=array();
foreach($keyValues as $key =>$val){
if($key!=$imageField){
$convertInfo[$val]=$info[$key];
}else{
$convertInfo[$val]=\Our\Common::getStaticFile($info[$key],ImageConst::memberAvatar) ;
}
public function getDeliveryManFields()
{
return array(
'qrcode_path' => 'qrcodePath',
'true_name' => 'trueName',
'mobile' => 'mobile',
);
}
public function convert($info){
$memberDao=\DAO\MemberModel::getInstance();
$info['qrcodePath']=$memberDao->getMemberAvatar($info['memberId']);
return $info;
}
public function getByWhere($where)
{
$this->setDb($this->dbName);
if(is_array($where)){
$where = $this->db->getSqlWhereByArray($where);
}
return $convertInfo;
$list = $this->db->select($this->detailField)->from($this->_tableName)->where($where)->fetchAll();
return $list;
}
public function getDeliveryManByStoreId($storeId){
$where['store_id']=$storeId;
return $this->getByWhere($where);
}
......
......@@ -45,7 +45,7 @@ class OrderModel extends \DAO\AbstractModel
public function getOrderDetailField()
{
return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,order_sn as orderSn,pay_sn as paySn,store_name as storeName,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,payment_time as paymentTime,finnshed_time as finnshedTime,need_shipping_fee as needShippingFee,payment_code as paymentCode,buyer_id as buyerId,buyer_name as buyerName,refund_condition as refundCondition,delay_time as delayTime,gmt_update as gmtUpdate';
return 'order_id as orderId,coupon_id as couponId,refund_amount as refundAmount,order_sn as orderSn,pay_sn as paySn,store_name as storeName,add_time as addTime,store_id as storeId,goods_amount as goodsAmount,shipping_fee as shippingFee,order_amount as orderAmount,shipping_type as shippingType,payment_type as paymentType,order_state as orderState,shipping_fee as shippingFee,refund_state as refundState,order_type as orderType,is_receive_payment as isReceivePayment,payment_time as paymentTime,finnshed_time as finnshedTime,need_shipping_fee as needShippingFee,payment_code as paymentCode,buyer_id as buyerId,buyer_name as buyerName,refund_condition as refundCondition,delay_time as delayTime,gmt_update as gmtUpdate,diliveryman_id as diliverymanId';
}
public function getOrderShippingField()
......
......@@ -64,7 +64,9 @@ class LinkMySQLModel{
}
public static function unsetDbConecet(){
unset(self::$_instances);
if(!empty(self::$_instances)){
unset(self::$_instances);
}
}
......
<?php
use Business\User\LoginV2Model;
use Error\ErrorModel;
use Our\ApiConst;
use Our\NameConst;
use Error\CodeConfigModel;
use Business\User\MemberServiceModel;
use Our\DescribeConst;
class MemberController extends \Our\Controller_AbstractApi {
private $memberService;
public function init(){
parent::init();
$this->memberService=MemberServiceModel::getInstance();
}
public function indexAction() {
throw new Exception('hello ',404);
}
/**
* 获取会员基本信息
*
* @var member/getMemberInfo
*/
public function getMemberInfoAction(){
$result=$this->memberService->getMemberInfo($this->memberId);
$this->success($result);
}
/**
* 保存用户信息
* @throws Exception
*/
public function saveMemberInfoAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->saveMemberInfo($data,$this->memberId);
if($result===false){
\Error\ErrorModel::throwException(\Error\CodeConfigModel::saveMemberFailed);
}
$this->success(new stdClass(),\Our\DescribeConst::saveMemberSuccess,\Our\DescribeConst::saveMemberSuccess);
}
/**
* 保存用户头像
*/
public function saveMemberAvatarAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->saveMemberAvatar($data,$this->memberId);
$member = $this->memberService->getMemberInfo($this->memberId);
if($result!==false){
$this->success(array('memberAvatar'=>$member['memberAvatar']));
}
\Error\ErrorModel::throwException(\Error\CodeConfigModel::saveMemberAvatarFailed);
}
/**
* 取消第三方绑定
*/
public function cancelBindingAction(){
$data = $this->req[\Our\NameConst::data];
$this->memberService->cancelBinding($data,$this->memberId);
if($data['userType']==\Our\ApiConst::userFromWx){
$userToken=$this->memberService->getWxUserToken($this->memberId);
if(!empty($userToken)){
$this->updateOldLoginKey($userToken);
}
}
$this->success(new stdClass(),\Our\DescribeConst::cancelBindingSuccess,\Our\DescribeConst::cancelBindingSuccess);
}
/**
* 已登录用户绑定第三方平台账号
*/
public function bindThirdPlatformAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->bindThirdPlatform($data,$this->memberId);
if($result){
$this->success(new stdClass(),\Our\DescribeConst::bindingSuccess,\Our\DescribeConst::bindingSuccess);
}
\Error\ErrorModel::throwException(\Error\CodeConfigModel::bindingSuccess);
}
/**
* 用户退出登录
* @throws Exception
*/
public function logOutAction(){
$key = $this->req[\Our\NameConst::data]['key'];
$result = $this->memberService->logOut($key);
session_unset();
session_destroy();
if($result){
$this->success(new stdClass());
}
ErrorModel::throwException(CodeConfigModel::noLogin);
}
/**
* 用户退出登录
* @throws Exception
*/
public function logOutTestAction(){
$key = $this->req[\Our\NameConst::data]['key'];
$result = $this->memberService->logOutTest($key);
if($result){
$this->success(new stdClass());
}
ErrorModel::throwException(CodeConfigModel::noLogin);
}
/**
* 修改密码
*/
public function changePasswordAction(){
$data = $this->req[\Our\NameConst::data];
$result = $this->memberService->changePassword($data,$this->memberId);
if($result){
$this->success(new stdClass(),\Our\DescribeConst::changePasswordSuccess,\Our\DescribeConst::changePasswordSuccess);
}
\Error\ErrorModel::throwException(\Error\CodeConfigModel::bindingSuccess);
}
/**
* 修改手机号码
*/
public function changeMobileAction(){
$data = $this->req[\Our\NameConst::data];
$this->memberService->changeMobile($data,$this->memberId);
$this->success(new stdClass(),\Our\DescribeConst::changeMobileSuccess,\Our\DescribeConst::changeMobileSuccess);
}
/**
* 微信绑定手机号码
*/
public function bindMobileForWxAction(){
$data = $this->req[\Our\NameConst::data];
$this->memberService->bindMobile($data,$this->memberId);
$this->success(new stdClass(),\Our\DescribeConst::bindMobileForWxSuccess,\Our\DescribeConst::bindMobileForWxSuccess);
}
}
......@@ -23,6 +23,7 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
parent::init();
$this->memberService = MemberServiceModel::getInstance();
$this->shopkeeperService = ShopkeeperServiceModel::getInstance();
$this->shopkeeperService->clientType=NameConst::pcClient;
}
/**
......@@ -151,6 +152,17 @@ class ShopkeeperController extends \Our\Controller_AbstractApi {
}
}
/**
* 获得配送员列表
*/
public function getDeliveriersAction(){
$result = $this->shopkeeperService->getDiliveryManByStoreId($this->memberId);
if($result!==false){
$this->success($result,\Our\DescribeConst::successMessage,\Our\DescribeConst::successMessage);
}
ErrorModel::throwException(CodeConfigModel::commonError);
}
/**
* 订单详情
*/
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>简单的html5 File测试 for pic2base64</title>
<style>
</style>
</head>
<body>
<form action="/client/shopkeeper/getDeliveriers" method="post">
用户登录状态key:<input name="data[key]" value="681c788e2d5a1a67bb4432aebe67c35b"/><br />
<p id="img_area"></p>
<input type="submit" value="提交">
</form>
</body>
</html>
\ No newline at end of file
......@@ -8,7 +8,7 @@
</head>
<body>
<form action="/shopkeeper/orderDetail" method="post">
<form action="/client/shopkeeper/orderDetail" method="post">
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
订单id:<input name="data[orderId]" value="935"/><br />
<p id="img_area"></p>
......
......@@ -8,7 +8,7 @@
</head>
<body>
<form action="/shopkeeper/orders" method="post">
<form action="/client/shopkeeper/orders" method="post">
用户登录状态key:<input name="data[key]" value="ceb72deab920ac0edb7272b2ed9dfa1e"/><br />
订单状态id:<input name="data[orderState]" value=""/><br />
......
......@@ -9,7 +9,7 @@
</head>
<body>
<form action="/user/login" method="post">
<form action="/client/user/login" method="post">
用户名:<input name="data[mobile]" value="18305954587"/><br />
密码:<input name="data[password]" value="123456"/><br />
key:<input name="data[key]" value="c2e5e7bfce8a727c7fb6f696bcaa23ac"/><br />
......
......@@ -14,20 +14,20 @@ $http = new swoole_http_server("0.0.0.0", 9501);
$http->on('request', function ($request, $response) {
try{
$respData=$request->post;
echo json_encode($respData);
echo 'abcdefg'.'|||||||||||';
// echo json_encode($respData);
if(isset($respData['type'])&&$respData['type']==1){
$info=$respData['content'];
$memberDao=$info['className']::getInstance(\Our\DbNameConst::masterDBConnectName);
echo json_encode($info['params']);
echo json_encode($info['params']);
if(empty($info['params'])){
$res=call_user_func_array(array($memberDao,$info['method']));
}else{
$res=call_user_func_array(array($memberDao,$info['method']),$info['params']);
}
$res=(isset($res)&&!empty($res))?$res:false;
unset($memberDao);
\Mysql\LinkMySQLModel::unsetDbConecet();
if($res!==false){
echo 'success';
$response->end(json_encode(array('status'=>1,'message'=>'执行成功','data'=>$res)));
......
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