コード例 #1
0
 public function footprint()
 {
     $id = $this->id;
     $result_array = array();
     $FootprintModel = new \Home\Model\FootprintModel();
     $footprint_info = $FootprintModel->get_user_footprint($id);
     $GoodModel = new \Home\Model\GoodModel();
     foreach ($footprint_info as $piece) {
         $good_info = $GoodModel->get_info($piece["good_id"]);
         array_push($result_array, array("good_info" => $good_info, "footprint_info" => $piece));
     }
     $this->assign("result", $result_array);
     $this->display();
 }
コード例 #2
0
 public function footprint()
 {
     $result_array = array();
     $item_id = $_REQUEST["id"];
     if (!$item_id) {
         $result_array["status"] = 3;
     }
     $user_id = $this->check_user();
     if ($user_id) {
         $FootprintModel = new \Home\Model\FootprintModel();
         $status = $FootprintModel->save_item($user_id, $item_id);
         if (!$status) {
             $result_array["status"] = 2;
         } else {
             $result_array["status"] = 1;
         }
     } else {
         $result_array["status"] = 0;
     }
     //end else
     $result_array["msg"] = "返回 status 0 用户未登录 1 成功 2 sql出现未知错误 3 浏览器发送数据有问题";
     echo json_encode($result_array);
 }