CBase.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  1. <?php
  2. namespace app\base;
  3. use think\Controller;
  4. use think\Cookie;
  5. //公用配置文件
  6. class CBase extends Controller
  7. {
  8. protected function _initialize()
  9. {
  10. header("Content-type: text/html; charset=utf-8");
  11. parent::_initialize();
  12. }
  13. //显示范围
  14. protected function showScope(){
  15. return [
  16. 1 => '全部',
  17. 2 => '线上',
  18. 3 => '线下',
  19. ];
  20. }
  21. //海媚门店地址
  22. protected function hmApiUrl()
  23. {
  24. return [
  25. //西门店
  26. 0 => '111.111.111.111:808',
  27. ];
  28. }
  29. //商品销售范围
  30. protected function salesScope(){
  31. return [
  32. '1' => '全部',
  33. '2' => '微信',
  34. '3' => '线下',
  35. ];
  36. }
  37. //包厢类型备注
  38. protected function boxTypeText()
  39. {
  40. return [
  41. '1' => '免费WIFI+专业无线麦克风,可容纳8~10人',
  42. '2' => '免费WIFI+专业无线麦克风,可容纳10~12人',
  43. '3' => '免费WIFI+专业无线麦克风,可容纳12~15人',
  44. '4' => '免费WIFI+专业无线麦克风,可容纳15~20人',
  45. ];
  46. }
  47. //包厢可容纳人数
  48. protected function boxAcceptNum()
  49. {
  50. return [
  51. '1' => '3-5人',
  52. '2' => '8-10人',
  53. '3' => '12-15人',
  54. '4' => '15-20人',
  55. '5' => '20-30人',
  56. '6' => '50-60人'
  57. ];
  58. }
  59. //时间排序
  60. protected function orderByTime()
  61. {
  62. return [
  63. '0' => '默认',
  64. '1' => '由近到远',
  65. '2' => '由远到近',
  66. ];
  67. }
  68. //价格排序
  69. protected function ordByPrice()
  70. {
  71. return [
  72. '0' => '默认',
  73. '1' => '由低到高',
  74. '2' => '由高到低',
  75. ];
  76. }
  77. //是否积分抵扣
  78. protected function using_integral()
  79. {
  80. return [
  81. '0' => '否',
  82. '1' => '是',
  83. ];
  84. }
  85. //是否支持存取
  86. protected function save()
  87. {
  88. return [
  89. '1' => '支持',
  90. '0' => '不支持',
  91. ];
  92. }
  93. //出入库类型
  94. protected function type()
  95. {
  96. return [
  97. '1' => '出库',
  98. '2' => '入库',
  99. ];
  100. }
  101. //存取状态
  102. protected function cunqu()
  103. {
  104. return [
  105. '1' => '存酒',
  106. '2' => '取酒',
  107. ];
  108. }
  109. //分类归属
  110. protected function catalog()
  111. {
  112. return [
  113. '1' => '归属商品',
  114. // '2' => '归属增值',
  115. // '3' => '归属套餐',
  116. ];
  117. }
  118. //对内对外
  119. protected function supply()
  120. {
  121. return [
  122. '0' => '内耗',
  123. '1' => '对外',
  124. ];
  125. }
  126. //商品归属
  127. protected function affiliation()
  128. {
  129. return [
  130. '1' => '厨房',
  131. '2' => '超市',
  132. ];
  133. }
  134. //线上预定设置 断电
  135. protected function predetermine()
  136. {
  137. return [
  138. '1' => '可预定',
  139. '2' => '不可预定',
  140. ];
  141. }
  142. //存取订单状态
  143. protected function access()
  144. {
  145. return [
  146. '1' => '待确认',
  147. '2' => '已完成',
  148. '3' => '被驳回',
  149. ];
  150. }
  151. //订单类型
  152. protected function ordType()
  153. {
  154. return [
  155. '1' => '正常',
  156. '2' => '续时',
  157. '3' => '换包前',
  158. '30' => '换包后',
  159. '31' => '换包前',
  160. '32' => '换包后',
  161. '4' => '退包',
  162. ];
  163. }
  164. //订单状态
  165. protected function ordStatText()
  166. {
  167. return [
  168. '-1' => '已取消',
  169. '0' => '<span style="color: red">待付款</span>',
  170. '1' => '已付款',
  171. '11' => '退款中',
  172. '12' => '退款成功',
  173. '2' => '进行中',
  174. '3' => '已完成',
  175. '4' => '电话预订',
  176. ];
  177. }
  178. //套餐种类
  179. protected function sort()
  180. {
  181. return [
  182. '1' => '普通套餐',
  183. '2' => '包厢套餐'
  184. ];
  185. }
  186. //包厢空闲状态
  187. protected function idleState()
  188. {
  189. return [
  190. '1' => '空闲',
  191. '2' => '使用中..',
  192. '3' => '被预定',
  193. '4' => '清理中..',
  194. '5' => '维修中',
  195. ];
  196. }
  197. //包厢显示类型
  198. protected function showType()
  199. {
  200. return [
  201. '1' => '可订包厢',
  202. '2' => '禁订包厢',
  203. '3' => '所有包厢',
  204. ];
  205. }
  206. //订单来源
  207. protected function ordSource()
  208. {
  209. return [
  210. '1' => '在线下单',
  211. '2' => '客服下单',
  212. '3' => '线下下单',
  213. ];
  214. }
  215. //订单来源
  216. protected function ordSources()
  217. {
  218. return [
  219. '1' => '微信',
  220. '2' => '微信',
  221. '3' => '线下'
  222. ];
  223. }
  224. //支付方式
  225. protected function linePayWay()
  226. {
  227. return [
  228. '1' => '现金',
  229. '2' => '刷卡',
  230. '3' => '微信',
  231. '4' => '会员后台扣款',
  232. '5' => '会员卡',
  233. '6' => '其它',
  234. '7' => '美团',
  235. '8' => '积分兑换',
  236. '9' => '抵用券',
  237. '10' => '抹零',
  238. '11' => '八折',
  239. '12' => '优惠',
  240. '13' => '扫码',
  241. '14' => '恒程支付',
  242. '15' => '接待',
  243. '16' => '云POS',
  244. '17' => '口碑',
  245. '18' => '电子券',
  246. '19' => '挂账',
  247. '20' => '消费'
  248. ];
  249. }
  250. //列表控制
  251. protected function listHtml($ulClass, $liClass, $fzClass)
  252. {
  253. $str = $this->fetch('public/leftList');
  254. $str = str_replace($ulClass, 'db', $str);
  255. $str = str_replace($liClass, 'cor', $str);
  256. $str = str_replace($fzClass, 'fz', $str);
  257. return $str;
  258. }
  259. //系统消息类型
  260. protected function sysMsgType()
  261. {
  262. return [
  263. '1' => '换房申请',
  264. '2' => '退款申请',
  265. '3' => '订单配送'
  266. ];
  267. }
  268. //获取短信验证码
  269. public function sendSMS($tel)
  270. {
  271. if (is_numeric($tel) && strlen($tel) == 11) {
  272. $random = rand(1000, 9999);
  273. $num = iconv("UTF-8", "GB2312//IGNORE", "短信验证码".$random);
  274. $zn = iconv("UTF-8", "GB2312//IGNORE", '盛世欢唱提醒您:');
  275. Cookie::set('no_time', $random, 90);
  276. $url = 'http://111.111.111.111:9050/cgi-bin/sendsms?username=sshc@sshc&password=******' . $tel . '&text=' . $zn . $num . '&subid=&msgtype=4';
  277. $this->curl($url);
  278. }
  279. return true;
  280. }
  281. //万能curl
  282. public function curl($url, $data = null)
  283. {
  284. $ch = curl_init();
  285. curl_setopt($ch, CURLOPT_URL, $url);
  286. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  287. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  288. if (!empty($data)) {
  289. curl_setopt($ch, CURLOPT_POST, 1);
  290. curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  291. }
  292. $out = curl_exec($ch);
  293. curl_close($ch);
  294. return json_decode($out, true);
  295. }
  296. //消息读取状态
  297. public function msgReadState()
  298. {
  299. return [
  300. '0' => '未读',
  301. '1' => '已读',
  302. ];
  303. }
  304. // 模板列表(盛世公司模板-曦尚测试)
  305. public function template_list()
  306. {
  307. $data = array(
  308. //寄存成功通知
  309. "deposit" => array(
  310. "template_id" => "dG2lTfmcqxQAzM9m-FMgAoni_x9OiW6iviW-47GgEGI",
  311. "data" => array(
  312. "first" => array('value' => '', 'color' => ''), //开头语
  313. "keyword1" => array('value' => '', 'color' => ''), //物品名称
  314. 'keyword2' => array('value' => '', 'color' => ''), //物品数量
  315. 'keyword3' => array('value' => '', 'color' => ''), //物品单位
  316. 'keyword4' => array('value' => '', 'color' => ''), //特殊说明
  317. 'keyword5' => array('value' => '', 'color' => ''), //到期时间
  318. 'remark' => array('value' => '', 'color' => ''), //结尾语
  319. ),
  320. ),
  321. //支取成功通知
  322. "draw" => array(
  323. "template_id" => "Adtzv7Z7bMmo5fbruKbwH3aOLe_Rv7ltmb0tTsPF8KA",
  324. "data" => array(
  325. "first" => array('value' => '', 'color' => ''), //开头语
  326. "keyword1" => array('value' => '', 'color' => ''), //物品名称
  327. 'keyword2' => array('value' => '', 'color' => ''), //物品数量
  328. 'keyword3' => array('value' => '', 'color' => ''), //物品单位
  329. 'remark' => array('value' => '', 'color' => ''), //结尾语
  330. ),
  331. ),
  332. //会员卡消费通知
  333. "card_consume" => array(
  334. "template_id" => "H8SWgAi7X3roaLeL6DY5TuWsr-YNIYrcHdM-ZGTW4BY",
  335. "data" => array(
  336. "first" => array('value' => '', 'color' => ''), //开头语
  337. "keyword1" => array('value' => '', 'color' => ''), //消费时间
  338. 'keyword2' => array('value' => '', 'color' => ''), //消费金额
  339. 'keyword3' => array('value' => '', 'color' => ''), //储值减扣
  340. 'keyword4' => array('value' => '', 'color' => ''), //卡上余额
  341. 'remark' => array('value' => '', 'color' => ''), //结尾语
  342. ),
  343. ),
  344. "remind" => array(
  345. "template_id" => "Gtgr-UEEDRNe4hCom8YNZJkRQr47lGdMV9XCWxIwk40",
  346. "data" => array(
  347. "first" => array('value' => '', 'color' => ''), //开头语
  348. "keyword1" => array('value' => '', 'color' => ''), //消费时间
  349. 'keyword2' => array('value' => '', 'color' => ''), //消费金额
  350. 'remark' => array('value' => '', 'color' => ''), //结尾语
  351. ),
  352. ),
  353. //寄存到期提醒
  354. "deposit_maturity" => array(
  355. "template_id" => "9iMI92uq2_KKEVT092l4ZRUUg9Jd3hBeJ4BlULTjd0A",
  356. "data" => array(
  357. "first" => array('value' => '', 'color' => ''), //开头语
  358. "keyword1" => array('value' => '', 'color' => ''), //物品名称
  359. "keyword2" => array('value' => '', 'color' => ''), //物品数量
  360. "keyword3" => array('value' => '', 'color' => ''), //物品单位
  361. "keyword4" => array('value' => '', 'color' => ''), //特殊说明
  362. "keyword5" => array('value' => '', 'color' => ''), //到期时间
  363. 'remark' => array('value' => '', 'color' => ''), //结尾语
  364. ),
  365. ),
  366. );
  367. return $data;
  368. }
  369. public function pay_type()
  370. {
  371. // 1 2刷卡 3微信 4支付宝 5会员卡 6其它',
  372. return array(
  373. 'xianjin' => 1, 'yinlianka' => 2, 'weixin' => 3, 'zhifubao' => 4, 'huiyuanka' => 5,
  374. 'meituan' => 7, 'jifenduihuan' => 8, 'diyongjuan' => 9, 'moling' => 10, 'bazhe' => 11,
  375. 'youhui' => 12, 'saoma' => 13, 'hengcheng' => 14, 'jiedai' => 15, 'yunPOS' => 16,
  376. 'koubei' => 17, 'dianzijuan' => 18, 'guazhang' => 19
  377. );
  378. }
  379. }