本文整理匯總了PHP中CommonAction::read方法的典型用法代碼示例。如果您正苦於以下問題:PHP CommonAction::read方法的具體用法?PHP CommonAction::read怎麽用?PHP CommonAction::read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CommonAction
的用法示例。
在下文中一共展示了CommonAction::read方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: read
public function read()
{
if (!$_GET["includeRows"] or $_GET['workflow']) {
return parent::read();
}
$formData = parent::read(true);
$formData["inputTime"] = $formData["dateline"] * 1000;
$rowModel = D("ReturnsDetailView");
$rows = $rowModel->where("ReturnsDetail.returns_id=" . $formData["id"])->select();
// echo $rowModel->getLastSql();exit;
$modelIds = array();
$rowData = array();
foreach ($rows as $v) {
$tmp = explode(DBC("goods.unique.separator"), $v["factory_code_all"]);
//根據factory_code_all factory_code - standard - version
$factory_code = array_shift($tmp);
$modelIds = array_merge($modelIds, $tmp);
$v["modelIds"] = $tmp;
$v["goods_id"] = sprintf("%s_%s_%s", $factory_code, $v["goods_id"], $v["goods_category_id"]);
// factory_code, id, catid
$v["goods_id_label"] = sprintf("%s", $v["goods_name"]);
$v["unit_price"] = $v["price"];
$v["amount"] = $v["num"];
$rowData[$v["id"]] = $v;
}
// array_flip(array_flip($modelIds));
$formData["customer_id_label"] = $formData["customer"];
$dataModel = D("DataModelDataView");
$rowData = $dataModel->assignModelData($rowData, $modelIds);
$formData["rows"] = reIndex($rowData);
$this->response($formData);
}
示例2: read
public function read()
{
if (!$_GET["includeRows"] or $_GET['workflow']) {
return parent::read();
}
// $this->readModel = "PurchaseView";
// $formData = parent::read(true);
$formData = D("PurchaseView")->find($_GET['id']);
$formData["inputTime"] = $formData["dateline"] * 1000;
// $formData["total_amount"] = $formData["total_price"];
// $formData["total_amount_real"] = $formData["total_price_real"];
// $formData["total_num"] = $formData["quantity"];
$rowModel = D("PurchaseDetailView");
$rows = $rowModel->where("PurchaseDetail.purchase_id=" . $formData["id"])->select();
// echo $rowModel->getLastSql();exit;
$modelIds = array();
$rowData = array();
foreach ($rows as $v) {
$tmp = explode(DBC("goods.unique.separator"), $v["factory_code_all"]);
//根據factory_code_all factory_code - standard - version
$factory_code = array_shift($tmp);
$modelIds = array_merge($modelIds, $tmp);
$v["modelIds"] = $tmp;
$v["goods_id"] = sprintf("%s_%s_%s", $factory_code, $v["goods_id"], $v["goods_category_id"]);
// factory_code, id, catid
$v["goods_id_label"] = sprintf("%s", $v["goods_name"]);
// $v["amount"] = $v["price"];
$rowData[$v["id"]] = $v;
}
// array_flip(array_flip($modelIds));
$formData["customer_id_label"] = $formData["customer"];
$params = array($rowData, $modelIds);
tag("assign_dataModel_data", $params);
$formData["rows"] = reIndex($params[0]);
/*
* 相關單據
* **/
$relateItem = array();
$id = abs(intval($_GET["id"]));
if (isAppLoaded("store")) {
$tmp = D("Stockin")->toRelatedItem("Purchase", $id);
if ($tmp) {
$relateItem = array_merge($relateItem, $tmp);
}
}
if (isAppLoaded("finance")) {
$tmp = D("FinancePayPlan")->toRelatedItem("Purchase", $id);
if ($tmp) {
$relateItem = array_merge($relateItem, $tmp);
}
}
if ($formData["source_model"] == "ProducePlan" && $formData["source_id"] && isAppLoaded("produce")) {
$tmp = D("ProducePlan")->getRelatedItem($formData["source_id"]);
if ($tmp) {
$relateItem[] = $tmp;
}
}
$formData["relatedItems"] = $relateItem;
$this->response($formData);
}
示例3: read
public function read()
{
if (!$_GET["includeRows"] or $_GET['workflow']) {
return parent::read();
}
$formData = parent::read(true);
$formData["start_time"] = $formData["start_time"] * 1000;
$formData["end_time"] = $formData["end_time"] * 1000;
$rowModel = D("ProducePlanDetailView");
$rows = $rowModel->where("ProducePlanDetail.plan_id=" . $formData["id"])->select();
// echo $rowModel->getLastSql();exit;
$modelIds = array();
$rowData = array();
foreach ($rows as $v) {
$tmp = explode(DBC("goods.unique.separator"), $v["factory_code_all"]);
//根據factory_code_all factory_code - standard - version
$factory_code = array_shift($tmp);
$modelIds = array_merge($modelIds, $tmp);
$v["modelIds"] = $tmp;
$v["stock"] = $v["stock_id"];
$v["stock_label"] = $v["stock_name"];
$v["goods_id"] = sprintf("%s_%s_%s", $factory_code, $v["goods_id"], $v["goods_category_id"]);
// factory_code, id, catid
$v["goods_id_label"] = sprintf("%s", $v["goods_name"]);
$rowData[$v["id"]] = $v;
}
// array_flip(array_flip($modelIds));
$params = array($rowData, $modelIds);
tag("assign_dataModel_data", $params);
$formData["rows"] = reIndex($params[0]);
$this->response($formData);
}
示例4: read
public function read()
{
if ("0" === $_GET["id"] && (!$_GET["email"] && !$_GET["username"])) {
return;
}
$item = parent::read(true);
unset($item["password"]);
$this->response($item);
}
示例5: read
public function read()
{
$data = parent::read(true);
$data["goods_id_label"] = $data["goods_name"];
$params = array(array($data), false);
tag("assign_dataModel_data", $params);
// print_r($data);exit;
$this->response($params[0][0]);
}
示例6: read
public function read()
{
$this->dataModelAlias = "crmBaseInfo";
$data = parent::read(true);
if (!$_GET["includeRows"]) {
$this->response($data);
return;
}
$model = D("RelationshipCompanyLinkman");
$rows = $model->where("relationship_company_id=" . $_GET["id"])->select();
$params = array($rows, "crmContact", false, false);
tag("assign_dataModel_data", $params);
$data["rows"] = $params[0];
$this->response($data);
}
示例7: read
public function read()
{
if (!$_GET["includeRows"] or $_GET['workflow']) {
return parent::read();
}
$this->readModel = "OrdersView";
$formData = parent::read(true);
$formData["inputTime"] = $formData["dateline"] * 1000;
$rowModel = D("OrdersDetailView");
$rows = $rowModel->where("OrdersDetail.order_id=" . $formData["id"])->select();
$modelIds = array();
$rowData = array();
foreach ($rows as $v) {
$tmp = explode(DBC("goods.unique.separator"), $v["factory_code_all"]);
//根據factory_code_all factory_code - standard - version
$factory_code = array_shift($tmp);
$modelIds = array_merge($modelIds, $tmp);
$v["modelIds"] = $tmp;
$v["goods_id"] = sprintf("%s_%s_%s", $factory_code, $v["goods_id"], $v["goods_category_id"]);
// factory_code, id, catid
$v["goods_id_label"] = sprintf("%s", $v["goods_name"]);
$rowData[$v["id"]] = $v;
}
$formData["customer_id_label"] = $formData["customer"];
$dataModel = D("DataModelDataView");
$rowData = $dataModel->assignModelData($rowData, $modelIds);
$formData["rows"] = reIndex($rowData);
if ($formData["tax_amount"]) {
$formData["includeTax"] = true;
}
/*
* 相關單據
* **/
$relateItem = array();
$id = abs(intval($_GET["id"]));
if (isAppLoaded("purchase")) {
$relateItem = array_merge($relateItem, (array) D("Purchase")->toRelatedItem("Orders", $id));
}
if (isAppLoaded("finance")) {
$relateItem = array_merge($relateItem, (array) D("FinanceReceivePlan")->toRelatedItem("Orders", $id));
}
if (isAppLoaded("produce")) {
$relateItem = array_merge($relateItem, (array) D("ProducePlan")->toRelatedItem("Orders", $id));
}
$formData["relatedItems"] = $relateItem;
$this->response($formData);
}
示例8: read
public function read()
{
if (is_numeric($_GET["id"]) && intval($_GET["id"]) === 0) {
$map = array();
$this->_filter($map);
list($factoryCode, ) = explode("_", $_GET["goods_id"]);
$fca = makeFactoryCode($_GET, $factoryCode);
$map["factory_code_all"] = $fca;
if (!$_GET["stock_id"]) {
return;
}
// print_r($fca);exit;
$model = D("StockProductList");
$data = $model->where($map)->find();
// echo $model->getLastSql();exit;
// print_r($map);exit;
$this->response(array("num" => $data["num"]));
} else {
return parent::read();
}
}
示例9: read
public function read()
{
$data = parent::read(true);
$data["prev_node_id"] = explode(",", $data["prev_node_id"]);
$data["next_node_id"] = explode(",", $data["next_node_id"]);
$executors = explode("|", $data["executor"]);
foreach ($executors as $exe) {
$tmp = explode(":", $exe);
switch ($tmp[0]) {
case "g":
$data["executor_group"] = explode(",", $tmp[1]);
break;
case "d":
$data["executor_department"] = explode(",", $tmp[1]);
break;
case "u":
$data["executor_user"] = explode(",", $tmp[1]);
}
}
$this->response($data);
}
示例10: read
public function read()
{
$data = parent::read(true);
$data["unreceived"] = $data["amount"] - $data["received"];
$this->response($data);
}
示例11: read
public function read()
{
if (!$_GET["includeRows"] or $_GET['workflow']) {
return parent::read();
}
$formDatas = parent::read(true);
$rowModel = D("StockinDetailView");
if ($formDatas["id"]) {
$isSingle = true;
$formDatas = array($formDatas);
}
foreach ($formDatas as $id => $formData) {
$formData["dateline"] *= 1000;
$formData["stock_manager"] = toTruename($formData["stock_manager"]);
$rows = $rowModel->where("StockinDetail.stockin_id=" . $formData["id"])->select();
$modelIds = array();
$rowData = array();
foreach ($rows as $v) {
$tmp = explode(DBC("goods.unique.separator"), $v["factory_code_all"]);
//根據factory_code_all factory_code - standard - version
$factory_code = array_shift($tmp);
$modelIds = array_merge($modelIds, $tmp);
$v["modelIds"] = $tmp;
$v["stock"] = $v["stock_id"];
$v["stock_label"] = $v["stock_name"];
$v["goods_id"] = sprintf("%s_%s_%s", $factory_code, $v["goods_id"], $v["goods_category_id"]);
// factory_code, id, catid
$v["goods_id_label"] = sprintf("%s", $v["goods_name"]);
$v["total_num"] = $v["num"];
$v["num"] = $v["num"] - $v["ined"];
$rowData[$v["id"]] = $v;
}
$params = array($rowData, $modelIds);
tag("assign_dataModel_data", $params);
$formData["rows"] = reIndex($params[0]);
if ($formData["source_model"] && $formData["source_id"]) {
$sourceModel = D($formData["source_model"] . "View");
$formData["source"] = $sourceModel->find($formData["source_id"]);
if ($_GET["includeRelated"]) {
try {
$model = D($formData["source_model"]);
$related = $model->getRelatedItem($formData["source_id"]);
$formData["relatedItems"][] = $related;
} catch (Exception $e) {
}
if ($_GET["includeSourceRows"]) {
$model = D($formData["source_model"] . "DetailView");
$foreignKey = $model->foreignKey ? $model->foreignKey : lcfirst($formData["source_model"]) . "_id";
$map[$foreignKey] = $formData["source_id"];
$formData["source_detail"] = $model->where($map)->select();
}
}
}
$results[] = $formData;
}
if ($isSingle) {
$this->response($formData);
return;
}
$response = array("count" => count($results), "datas" => $results);
$this->response($response);
}