mirror of
https://gitee.com/ShopeX/OMS
synced 2026-03-23 10:55:34 +08:00
96 lines
2.1 KiB
PHP
96 lines
2.1 KiB
PHP
<?php
|
||
/**
|
||
* Copyright © ShopeX (http://www.shopex.cn). All rights reserved.
|
||
* See LICENSE file for license details.
|
||
*/
|
||
|
||
abstract class erpapi_account_request_abstract
|
||
{
|
||
|
||
|
||
/**
|
||
* 渠道
|
||
*
|
||
* @var string
|
||
**/
|
||
protected $__channelObj;
|
||
|
||
protected $__resultObj;
|
||
|
||
protected $__configObj;
|
||
|
||
final public function init(erpapi_channel_abstract $channel, erpapi_config $config, erpapi_result $result)
|
||
{
|
||
$this->__channelObj = $channel;
|
||
|
||
$this->__configObj = $config;
|
||
|
||
$this->__resultObj = $result;
|
||
|
||
// 默认以JSON格式返回
|
||
$this->__caller = kernel::single('erpapi_caller',array('uniqid'=>uniqid('unionpay')))
|
||
->set_config($config)
|
||
->set_channel($channel)
|
||
->set_result($result);
|
||
}
|
||
|
||
/**
|
||
* 成功输出
|
||
*
|
||
* @return void
|
||
* @author
|
||
**/
|
||
final public function succ($msg='', $msgcode='', $data=null)
|
||
{
|
||
return array('rsp'=>'succ', 'msg'=>$msg, 'msg_code'=>$msgcode, 'data'=>$data);
|
||
}
|
||
|
||
/**
|
||
* 失败输出
|
||
*
|
||
* @return void
|
||
* @author
|
||
**/
|
||
/**
|
||
* error
|
||
* @param mixed $msg msg
|
||
* @param mixed $msgcode msgcode
|
||
* @param mixed $data 数据
|
||
* @return mixed 返回值
|
||
*/
|
||
final public function error($msg, $msgcode, $data=null)
|
||
{
|
||
return array('rsp'=>'fail','msg'=>$msg,'err_msg'=>$msg,'msg_code'=>$msgcode,'data'=>$data);
|
||
}
|
||
|
||
/**
|
||
* 生成唯一键
|
||
*
|
||
* @return void
|
||
* @author
|
||
**/
|
||
/**
|
||
* uniqid
|
||
* @return mixed 返回值
|
||
*/
|
||
final public function uniqid(){
|
||
$microtime = utils::microtime();
|
||
$unique_key = str_replace('.','',strval($microtime));
|
||
$randval = uniqid('', true);
|
||
$unique_key .= strval($randval);
|
||
return md5($unique_key);
|
||
}
|
||
|
||
/**
|
||
* 回调
|
||
* @param $response Array
|
||
* @param $callback_params Array
|
||
* @return array
|
||
**/
|
||
|
||
|
||
public function callback($response, $callback_params)
|
||
{
|
||
return $response;
|
||
}
|
||
} |