12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- /**
- * 封装一些常规的订单操作
- */
- class Model_logic_tools extends Lin_Model {
- public $key = "v!frlbpnjgir6amg"; //加密所需要到的key
- public $iv = "k!2w94m6jt!6ook4";//加密所需要到的iv
-
- function __construct(){
- parent::__construct();
-
- }
- // 返回参数方法
- /**
- * $code 状态码
- * $msg 返回信息
- * $data 数据
- */
- function ret_json($code,$msg,$data = []){
- return json_encode([
- 'code'=>$code,
- 'msg'=>$msg,
- 'data'=>$data
- ],JSON_UNESCAPED_UNICODE);
- }
- //根据shop 来判断是那个店铺 到时间直接选中表就好
- function getshopname($shop){
- $arr = [
- 3=>"alipearlhair",
- 4=>"westkis"
- ];
- if(!isset($arr[$shop])){
- return "";
- }else{
- return $arr[$shop];
- }
- }
- function getOrderTable($shop){
- $tt = [];
- $smt = [];
- $dlz = [3,4];
- if(in_array($shop,$tt)){
- return "fullordertt";
- }
- if(in_array($shop,$smt)){
- return "fullordersmt";
- }
- if(in_array($shop,$dlz)){
- return "fullorder";
- }
- return "";
-
- }
- /**
- * 对外通信的加密工具类
- *$decrypt 要加密内容
- */
- function toolsjiami($decrypt,$key = "",$iv = ""){
- if(empty($key)){
- $key = $this->key;
- }
- if(empty($iv)){
- $iv = $this->iv;
- }
- return openssl_encrypt($decrypt,'AES-128-CBC',$key,0,$iv);
- }
- /**
- * 对外通信的解密工具类
- *$encrypt 要解密内容
- */
- function toolsjiemi($encrypt,$key,$iv){
- if(empty($key)){
- $key = $this->key;
- }
- if(empty($iv)){
- $iv = $this->iv;
- }
- return openssl_decrypt($encrypt,'AES-128-CBC',$key,0,$iv);
- }
- }
|