| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- <?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);
- }
- function ret_arr($code,$msg,$data = []){
- return [
- 'code'=>$code,
- 'msg'=>$msg,
- 'data'=>$data
- ];
- }
- //根据shop 来判断是那个店铺 到时间直接选中表就好
- function getshopname($shop){
- $arr = [
- 2=>"asteriahair",
- 3=>"alipearlhair",
- 4=>"westkis",
- 6=>"wigginshair",
- ];
- if(!isset($arr[$shop])){
- return "";
- }else{
- return $arr[$shop];
- }
- }
- function getOrderTable($shop){
- $tt = [];
- $smt = [];
- $dlz = [2,3,4,6];
- 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);
- }
- function writeCache($filename,$data){
- }
- function readCache($filename){
-
- }
- function transfer_img_url($url,$host){
- if(strpos($url,'/img/thumb?src=') !== false){
- preg_match('/src=([^&]+)&w=/', $url, $matches);
- $result = $matches[1] ?? '';
- if(empty($result)){
- return $url;
- }
- $result = $host.$result;
- return $result;
- }elseif(strpos($url,'https://1.wepolicy.cn')!== false){
- $str = str_replace('https://1.wepolicy.cn',$host,$url);
- return $str;
- }elseif(strpos($url,'http://1.wepolicy.cn')!== false){
- $str = str_replace('http://1.wepolicy.cn',$host,$url);
- return $str;
- }elseif(strpos($url,'http://erp.hnwmzp.cn')!== false){
- $str = str_replace('http://erp.hnwmzp.cn',$host,$url);
- return $str;
- }elseif(strpos($url,'http://a.wepolicy.cn')!== false){
- $str = str_replace('http://a.wepolicy.cn',$host,$url);
- return $str;
- }elseif(strpos($url,'https://erp.hnwmzp.cn')!== false){
- $str = str_replace('http://a.wepolicy.cn',$host,$url);
- return $str;
- }else{
- return $url;
- }
- }
- }
|