Пример #1
0
 /**
  * 正确的API返回结果,形如:
  * 
  * {'code':200, 'msg':'success', 'data':null}
  *
  * @return	array
  */
 public function ok($data = NULL)
 {
     return common_result_ok($data);
 }
Пример #2
0
function save_house_image($CI, $uid, $hid, $sub)
{
    $check_result = common_check_upload_input($CI);
    // 获取扩展名
    if (!is_ok_result($check_result)) {
        return $check_result;
    }
    $ext = $check_result['data'];
    $tempFileName = generate_fn($CI, $ext);
    $tempFilePath = 'uploads/house/' . $sub . '-' . $uid . '-' . $hid . '/';
    $tempFileAbsPath = FCPATH . $tempFilePath;
    if (!file_exists($tempFileAbsPath)) {
        mkdir($tempFileAbsPath);
    }
    file_put_contents($tempFileAbsPath . $tempFileName, file_get_contents('php://input'));
    return common_result_ok($tempFilePath . $tempFileName);
}
Пример #3
0
 public function house()
 {
     $ext = $this->common_check_input();
     $uid = get_session_uid();
     if (!isset($uid)) {
         echo json_encode(common_result(400, '操作用户未知'));
         return;
     }
     $tempFileName = $this->generateHouseFileName($ext);
     $tempFilePath = 'uploads/house/' . $uid . '/';
     $tempFileAbsPath = FCPATH . $tempFilePath;
     if (!file_exists($tempFileAbsPath)) {
         mkdir($tempFileAbsPath);
     }
     file_put_contents($tempFileAbsPath . $tempFileName, file_get_contents('php://input'));
     echo json_encode(common_result_ok($tempFilePath . $tempFileName));
 }