Model_logic_tools.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * 封装一些常规的订单操作
  4. */
  5. class Model_logic_tools extends Lin_Model {
  6. public $key = "v!frlbpnjgir6amg"; //加密所需要到的key
  7. public $iv = "k!2w94m6jt!6ook4";//加密所需要到的iv
  8. function __construct(){
  9. parent::__construct();
  10. }
  11. // 返回参数方法
  12. /**
  13. * $code 状态码
  14. * $msg 返回信息
  15. * $data 数据
  16. */
  17. function ret_json($code,$msg,$data = []){
  18. return json_encode([
  19. 'code'=>$code,
  20. 'msg'=>$msg,
  21. 'data'=>$data
  22. ],JSON_UNESCAPED_UNICODE);
  23. }
  24. //根据shop 来判断是那个店铺 到时间直接选中表就好
  25. function getshopname($shop){
  26. $arr = [
  27. // 3=>"alipearlhair",
  28. 4=>"westkis"
  29. ];
  30. if(!isset($arr[$shop])){
  31. return "";
  32. }else{
  33. return $arr[$shop];
  34. }
  35. }
  36. function getOrderTable($shop){
  37. $tt = [];
  38. $smt = [];
  39. $dlz = [3,4];
  40. if(in_array($shop,$tt)){
  41. return "fullordertt";
  42. }
  43. if(in_array($shop,$smt)){
  44. return "fullordersmt";
  45. }
  46. if(in_array($shop,$dlz)){
  47. return "fullorder";
  48. }
  49. return "";
  50. }
  51. /**
  52. * 对外通信的加密工具类
  53. *$decrypt 要加密内容
  54. */
  55. function toolsjiami($decrypt){
  56. return openssl_encrypt($decrypt,'AES-128-CBC',$this->key,0,$this->iv);
  57. }
  58. /**
  59. * 对外通信的解密工具类
  60. *$encrypt 要解密内容
  61. */
  62. function toolsjiemi($encrypt){
  63. return openssl_decrypt($encrypt,'AES-128-CBC',$this->key,0,$this->iv);
  64. }
  65. }