1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- /**
- * mobile公共方法
- *
- * 公共方法
- *
- */
- defined('InShopNC') or exit('Access Invalid!');
- require_once(BASE_CORE_PATH . '/framework/libraries/model.php');
- require_once(BASE_DATA_PATH . '/model/member.model.php');
- function joutput_data($datas,$type='')
- {
- $data = [];
- $code = errcode::Success;
- $data['code'] = $code;
- $data['message'] = errcode::msg($code);
- $data['datas'] = $datas;
- if($_SESSION['client_type'] != 'ajax')
- {
- $contents = ob_get_clean();
- if(!empty($contents)) {
- Log::record($contents,Log::ERR);
- }
- ob_start();
- }
- if(!empty($type) && $type == 'web') {
- echo(json_encode($data,JSON_UNESCAPED_UNICODE));
- } else {
- echo(json_encode($data));
- }
- }
- function joutput_error($code,$message = '',$type='')
- {
- if(empty($message)) {
- $message = errcode::msg($code);
- }
- $data = [];
- $data['code'] = $code;
- $data['message'] = $message;
- $data['datas'] = [];
- if($_SESSION['client_type'] != 'ajax')
- {
- $contents = ob_get_clean();
- if(!empty($contents)) {
- Log::record($contents,Log::ERR);
- }
- ob_start();
- }
- Log::record("code = {$code} message = {$message}",Log::ERR);
- if(!empty($type) && $type == 'web') {
- echo(json_encode($data,JSON_UNESCAPED_UNICODE));
- } else {
- echo(json_encode($data,JSON_UNESCAPED_UNICODE));
- }
- }
|