You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
7.7 KiB
PHP
165 lines
7.7 KiB
PHP
<?php
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
class TrainDMS extends CI_Controller {
|
|
|
|
public function __construct(){
|
|
parent::__construct();
|
|
$this->load->model("dms_model");
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 接口总汇,根据接受数据,调用不同接口,返回数据
|
|
* @return {*}
|
|
* @Date Changed:
|
|
*/
|
|
public function dmsCallback(){
|
|
$back_json = file_get_contents('php://input');
|
|
$dms_backdata = json_decode($back_json);
|
|
|
|
if(!empty($dms_backdata)){
|
|
//判断接口调用是否合法
|
|
$TimeStamp = $dms_backdata->authentication->timeStamp;
|
|
$serviceName = $dms_backdata->authentication->serviceName; //每个接口都有自己名称
|
|
$companyId = "haina";
|
|
$key = "dms001";
|
|
|
|
$strSign = $TimeStamp.$serviceName.$companyId.$key; //加密前的令牌
|
|
$Sign = md5($strSign);
|
|
$messageIdentity = $dms_backdata->authentication->messageIdentity;
|
|
$ResultNoticeResponse = new stdClass();
|
|
if ($Sign == $messageIdentity){
|
|
$ResultNoticeResponse->returnCode = 1;
|
|
$ResultNoticeResponse->returnMsg = "success";
|
|
//这里正常处理各种接口调用
|
|
if ($serviceName=="dms.login"){ //登录
|
|
$username = $dms_backdata->loginInfo->username;
|
|
$password = $dms_backdata->loginInfo->password;
|
|
$ResultNoticeResponse->loginInfo = new stdClass();
|
|
$LoginInfo = $this->dms_model->Login($username,$password);
|
|
if (empty($LoginInfo)){
|
|
$ResultNoticeResponse->loginInfo->status = 0; //账号密码错误。
|
|
$ResultNoticeResponse->loginInfo->dt_username = '';
|
|
$ResultNoticeResponse->loginInfo->dt_payrule = "";
|
|
$ResultNoticeResponse->loginInfo->dt_usertype = "";
|
|
$ResultNoticeResponse->loginInfo->dt_HtId = "";
|
|
$ResultNoticeResponse->loginInfo->dt_id = "";
|
|
}else{
|
|
$ResultNoticeResponse->loginInfo->status = 1; //账号密码是否正常。
|
|
$ResultNoticeResponse->loginInfo->dt_username = $LoginInfo->dt_username;
|
|
$ResultNoticeResponse->loginInfo->dt_payrule = $LoginInfo->dt_payrule;
|
|
$ResultNoticeResponse->loginInfo->dt_usertype = $LoginInfo->dt_usertype;
|
|
$ResultNoticeResponse->loginInfo->dt_HtId = $LoginInfo->dt_HtId;
|
|
$ResultNoticeResponse->loginInfo->dt_id = $LoginInfo->dt_id;
|
|
}
|
|
|
|
}else if($serviceName=="dms.dmlist"){ //分销商列表
|
|
$arrKeyword = new stdClass();
|
|
$arrKeyword = $dms_backdata->arrKeyword;
|
|
|
|
$dmlist = $this->dms_model->get_DmList($arrKeyword);
|
|
$resultData = $dmlist["data"];
|
|
$total = $dmlist["total"];
|
|
$ResultNoticeResponse->dmlist = new stdClass();
|
|
$ResultNoticeResponse->dmlist->data=$resultData;
|
|
$ResultNoticeResponse->dmlist->total = $total;
|
|
// "arrKeyword": {
|
|
// "s_username": "ssss",
|
|
// "s_ename": "vvv",
|
|
// "page": false,
|
|
// "per_page": 20
|
|
// }
|
|
}else if($serviceName=="dms.getpayrule"){ //获取支付规则列表数据
|
|
$getpayrule = $this->dms_model->get_payrule();
|
|
$ResultNoticeResponse->getpayrule = $getpayrule;
|
|
}else if ($serviceName=="dms.addsave"){ //添加供应商操作
|
|
$formData = new stdClass() ;
|
|
$formData = $dms_backdata->formInfo;
|
|
$rStatus = $this->dms_model->addsave($formData);
|
|
$ResultNoticeResponse->addsave = $rStatus;
|
|
}else if ($serviceName=="dms.getDmsDetail") { //修改分销商详细页
|
|
$id = $dms_backdata->DmsDetail->dtid;
|
|
$dmsDetail = $this->dms_model->getDmsDetail($id);
|
|
$ResultNoticeResponse->DmsDetail = $dmsDetail;
|
|
}else if ($serviceName=="dms.editsave"){ //修改分销商保存
|
|
|
|
$formData = new stdClass() ;
|
|
$formData = $dms_backdata->formInfo;
|
|
$rStatus = $this->dms_model->editsave($formData);
|
|
$ResultNoticeResponse->editsave = $rStatus;
|
|
}else if ($serviceName=="dms.delete"){ //删除分销商
|
|
$id = $dms_backdata->DmsDetail->dtid;
|
|
$rStatus = $this->dms_model->dmdDelete($id);
|
|
$ResultNoticeResponse->dmsdelete = $rStatus;
|
|
}else if ($serviceName == "dms.payrecord"){ //支付记录
|
|
$arrKeyword = new stdClass();
|
|
$arrKeyword = $dms_backdata->arrKeyword;
|
|
$payrecord = $this->dms_model->payrecord($arrKeyword);
|
|
$resultData = $payrecord["data"];
|
|
$total = $payrecord["total"];
|
|
$ResultNoticeResponse->payrecord = new stdClass();
|
|
$ResultNoticeResponse->payrecord->data=$resultData;
|
|
$ResultNoticeResponse->payrecord->total = $total;
|
|
}else if ($serviceName=="dms.payrecord_addsave"){ //支付记录添加
|
|
$formData = new stdClass() ;
|
|
$formData = $dms_backdata->formInfo;
|
|
$rStatus = $this->dms_model->payrecord_addsave($formData);
|
|
$ResultNoticeResponse->addsave = $rStatus;
|
|
}else if ($serviceName=="dms.payrecord_delete"){ //支付记录删除
|
|
$id = $dms_backdata->payrecord->dp_id;
|
|
$htid = $dms_backdata->payrecord->dp_HtId;
|
|
$rStatus = $this->dms_model->payrecord_delete($id,$htid);
|
|
$ResultNoticeResponse->dmsdelete = $rStatus;
|
|
}else if ($serviceName=="dms.trainorder"){ //订单列表-火车
|
|
$arrKeyword = new stdClass();
|
|
$arrKeyword = $dms_backdata->arrKeyword;
|
|
$trainorder = $this->dms_model->trainorder($arrKeyword);
|
|
$resultData = $trainorder["data"];
|
|
$total = $trainorder["total"];
|
|
$ResultNoticeResponse->trainorder = new stdClass();
|
|
$ResultNoticeResponse->trainorder->data=$resultData;
|
|
$ResultNoticeResponse->trainorder->total = $total;
|
|
}else if ($serviceName == "dms.dmslisteasy"){ //所有分销商数据,下拉框使用
|
|
$getdmseasy = $this->dms_model->get_dmseasy();
|
|
$ResultNoticeResponse->getpayrule = $getdmseasy;
|
|
}else if ($serviceName=="dms.getpaydetail"){ //获取某一个分销商的所有财务信息
|
|
$id = $dms_backdata->htid;
|
|
$getpaydetail = $this->dms_model->get_paydetail($id);
|
|
$ResultNoticeResponse->getpaydetail = $getpaydetail;
|
|
}
|
|
|
|
|
|
}else{
|
|
$ResultNoticeResponse->returnCode = 0;
|
|
$ResultNoticeResponse->returnMsg = "messageIdentity is error!";
|
|
}
|
|
echo json_encode($ResultNoticeResponse);
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description:
|
|
* @return {*}
|
|
* @Date Changed:
|
|
*/
|
|
public function index()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
public function login (){
|
|
|
|
}
|
|
|
|
public function addUser(){
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* End of file TrainDMS.php */
|